I'm new to react's testing and I created a simple test for checkbox:
import React from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import { Checkbox } from '../../../src/components/Checkbox';
...
describe('Checkbox', () => {
test('Simple render', () => {
const checkbox = shallow(
<Checkbox
label="Label"
value={true}
onUpdate={null}></ReportCheckBox>
);
expect(toJson(checkbox)).toMatchInlineSnapshot();
});
});
The test works as it should but it generates the snapshot inside the code itself and not in a separate file in the snapshots folder as it should. What did I do wrong?
After few minutes I've noticed that I was calling
toMatchInlineSnapshotinstead of:toMatchSnapshot