From 6d72c2bbe13573433f96dfa1df09e0c839e0fc03 Mon Sep 17 00:00:00 2001 From: Gan Eng Chin Date: Thu, 9 Mar 2023 01:08:28 +0800 Subject: [PATCH] Fix failed test for Campaigns component. --- .../Campaigns/Campaigns.test.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.test.tsx b/plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.test.tsx index 4a533f5b9d3..52170ff65d0 100644 --- a/plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.test.tsx +++ b/plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.test.tsx @@ -19,9 +19,15 @@ jest.mock( '~/marketing/hooks', () => ( { useNewCampaignTypes: jest.fn(), } ) ); -jest.mock( './CreateNewCampaignModal', () => ( { - CreateNewCampaignModal: () =>
Create a new campaign
, -} ) ); +jest.mock( '~/marketing/components', () => { + const originalModule = jest.requireActual( '~/marketing/components' ); + + return { + __esModule: true, + ...originalModule, + CreateNewCampaignModal: () =>
Create a new campaign
, + }; +} ); /** * Create a test campaign data object.