- name test files
*.test.js
- run tests with npm test
- storing svg in here for now, but it won't be necessary to keep them in here
- should be for static images and such
- components go in here in their own folders
- deciding whether we should have subfolders within component folders
- routes will be defined in here and imported where needed
- reusable/shared functions belong here
Add the following to your test.tsx file for your component and replace placeholder with your component name.
it('matches snapshot', () => {
const placeholder = renderer.create(<Placeholder />).toJSON();
expect(placeholder).toMatchSnapshot();
});
To run tests on your own, enter npm test
from your cmd.
To update a snapshot enter u
while running the script where the test fails, or run jest -u
Be careful not to update a failed snapshot test if you're not sure about why it's failing.