From 0b884d64f67f52ad5f1831729022d543a7bc98ba Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Tue, 19 May 2020 14:09:07 +0200 Subject: [PATCH] Fix problem with spread types not allowed --- .../src/components/AuditList/index.test.tsx | 3 ++- .../src/components/AuditView/index.test.tsx | 11 +++++++---- .../src/components/CreateAudit/index.test.tsx | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/plugins/lighthouse/src/components/AuditList/index.test.tsx b/plugins/lighthouse/src/components/AuditList/index.test.tsx index 2813f554b8..94181f166d 100644 --- a/plugins/lighthouse/src/components/AuditList/index.test.tsx +++ b/plugins/lighthouse/src/components/AuditList/index.test.tsx @@ -15,12 +15,13 @@ */ jest.mock('react-router-dom', () => { + const actual = jest.requireActual('react-router-dom'); const mocks = { replace: jest.fn(), push: jest.fn(), }; return { - ...jest.requireActual('react-router-dom'), + ...actual, useHistory: jest.fn(() => mocks), }; }); diff --git a/plugins/lighthouse/src/components/AuditView/index.test.tsx b/plugins/lighthouse/src/components/AuditView/index.test.tsx index 000780a1cb..9f218faf53 100644 --- a/plugins/lighthouse/src/components/AuditView/index.test.tsx +++ b/plugins/lighthouse/src/components/AuditView/index.test.tsx @@ -16,10 +16,13 @@ /* eslint-disable jest/no-disabled-tests */ -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), - useParams: jest.fn(() => ({})), -})); +jest.mock('react-router-dom', () => { + const actual = jest.requireActual('react-router-dom'); + return { + ...actual, + useParams: jest.fn(() => ({})), + }; +}); import React from 'react'; import mockFetch from 'jest-fetch-mock'; diff --git a/plugins/lighthouse/src/components/CreateAudit/index.test.tsx b/plugins/lighthouse/src/components/CreateAudit/index.test.tsx index f15ee19ede..e36b00d489 100644 --- a/plugins/lighthouse/src/components/CreateAudit/index.test.tsx +++ b/plugins/lighthouse/src/components/CreateAudit/index.test.tsx @@ -15,12 +15,13 @@ */ jest.mock('react-router-dom', () => { + const actual = jest.requireActual('react-router-dom'); const mocks = { replace: jest.fn(), push: jest.fn(), }; return { - ...jest.requireActual('react-router-dom'), + ...actual, useHistory: jest.fn(() => mocks), }; });