Skip to content

Commit 1a96a5c

Browse files
committed
chore: make sure to unmount component in tests
1 parent 2db86c9 commit 1a96a5c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

examples/snapshot/__tests__/clock.test.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import Clock from '../Clock';
88
jest.useFakeTimers().setSystemTime(1482363367071);
99

1010
it('renders correctly', () => {
11-
const tree = renderer.create(<Clock />).toJSON();
12-
expect(tree).toMatchSnapshot();
11+
const testRenderer = renderer.create(<Clock />);
12+
13+
try {
14+
expect(testRenderer.toJSON()).toMatchSnapshot();
15+
} finally {
16+
testRenderer.unmount();
17+
}
1318
});

0 commit comments

Comments
 (0)