Skip to content

Commit

Permalink
chore: make sure to unmount component in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Sep 19, 2023
1 parent 2db86c9 commit 1a96a5c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions examples/snapshot/__tests__/clock.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import Clock from '../Clock';
jest.useFakeTimers().setSystemTime(1482363367071);

it('renders correctly', () => {
const tree = renderer.create(<Clock />).toJSON();
expect(tree).toMatchSnapshot();
const testRenderer = renderer.create(<Clock />);

try {
expect(testRenderer.toJSON()).toMatchSnapshot();
} finally {
testRenderer.unmount();
}
});

0 comments on commit 1a96a5c

Please sign in to comment.