JEST Creating this repo to prepare to run TL hours tomorrow.
-
npm install
react-test-renderer
-
import renderer into test file
import renderer from 'react-test-renderer'
-
create test in test file
test('should match snapshot', () => {
const tree = renderer.create(<App />).toJSON();
expect(tree).toMatchSnapshot();
});
- run tests usint
yarn test
- jest will create snaphsot folder and save snapshot
- If snapshot ever mismatches actual component when rendering.
- enter
u
to update snapshot - or update file to match snapshot
- enter
- npm install
axios