From 7cb0cf31517607b72dbbb41296c73c0d0d8ee9da Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 4 Apr 2022 15:51:57 -0500 Subject: [PATCH] test: clean up restoreAllMocks() clearAllMocks() does not remove mock implementations, so we need to be using restoreAllMocks() instead. Also ensure that it is called first in case the other cleanup code needs to call a mocked function. --- src/explorer/Explorer.test.tsx | 2 +- src/licenses/LicenseDialog.test.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/explorer/Explorer.test.tsx b/src/explorer/Explorer.test.tsx index ac2e4d9c..378b1230 100644 --- a/src/explorer/Explorer.test.tsx +++ b/src/explorer/Explorer.test.tsx @@ -16,8 +16,8 @@ import { } from './actions'; afterEach(async () => { + jest.restoreAllMocks(); cleanup(); - jest.clearAllMocks(); localStorage.clear(); }); diff --git a/src/licenses/LicenseDialog.test.tsx b/src/licenses/LicenseDialog.test.tsx index f6297695..7d242fde 100644 --- a/src/licenses/LicenseDialog.test.tsx +++ b/src/licenses/LicenseDialog.test.tsx @@ -8,9 +8,9 @@ import { testRender } from '../../test'; import LicenseDialog from './LicenseDialog'; afterEach(() => { + jest.restoreAllMocks(); cleanup(); localStorage.clear(); - jest.clearAllMocks(); }); describe('LicenseDialog', () => {