mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-08-03 23:54:19 -07:00
Fix putting elements under <p> (#521)
* Fix putting elements under <p> * Added Jest test to catch this mistake in the future. It does it by watching console.error(). To add in fixing the bug the test's emulated `console.error()` are echoed to the jest console.error() so they are not lost. * I tested this by putting a `<h1>` back into the `<p>` and it caught it. * Update scoreStepsList.test.tsx * added comment to move console.error ticket to global location Co-authored-by: Vim <86254807+vim-usds@users.noreply.github.com>
This commit is contained in:
parent
6691df3e31
commit
f7bfc979ba
4 changed files with 104 additions and 72 deletions
|
@ -3,6 +3,14 @@ import {render} from '@testing-library/react';
|
|||
import ScoreStepsList from './scoreStepsList';
|
||||
import {LocalizedComponent} from '../test/testHelpers';
|
||||
|
||||
// TODO: Move this to a location that will detect on all tests
|
||||
// See ticket: #550
|
||||
beforeAll(() => {
|
||||
jest.spyOn(global.console, 'error').mockImplementation((...params) => {
|
||||
console.error(params);
|
||||
});
|
||||
});
|
||||
|
||||
describe('rendering of the component', () => {
|
||||
const {asFragment} = render(
|
||||
<LocalizedComponent>
|
||||
|
@ -13,4 +21,8 @@ describe('rendering of the component', () => {
|
|||
it('should match the snapshot of the MapIntroduction component', () => {
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('No console errors', () => {
|
||||
expect(console.error).toBeCalledTimes(0);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue