From 1a96a5c6a348dd3bf9134813d1a99e6273f53ec2 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 19 Sep 2023 16:26:06 +0200 Subject: [PATCH] chore: make sure to unmount component in tests --- examples/snapshot/__tests__/clock.test.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/snapshot/__tests__/clock.test.js b/examples/snapshot/__tests__/clock.test.js index d8aeee292b4b..f03ba5e9282d 100644 --- a/examples/snapshot/__tests__/clock.test.js +++ b/examples/snapshot/__tests__/clock.test.js @@ -8,6 +8,11 @@ import Clock from '../Clock'; jest.useFakeTimers().setSystemTime(1482363367071); it('renders correctly', () => { - const tree = renderer.create().toJSON(); - expect(tree).toMatchSnapshot(); + const testRenderer = renderer.create(); + + try { + expect(testRenderer.toJSON()).toMatchSnapshot(); + } finally { + testRenderer.unmount(); + } });