From 8a6166c91b3edb2060a24965f9357656f4754565 Mon Sep 17 00:00:00 2001 From: Eric Jinks <3147296+Jinksi@users.noreply.github.com> Date: Thu, 28 Sep 2023 11:34:25 +1000 Subject: [PATCH] Mock @wordpress/data to fix broken tests --- .../payment-details/summary/test/index.test.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/client/payment-details/summary/test/index.test.tsx b/client/payment-details/summary/test/index.test.tsx index 8f3647c643f..0088cfee3e7 100755 --- a/client/payment-details/summary/test/index.test.tsx +++ b/client/payment-details/summary/test/index.test.tsx @@ -50,6 +50,22 @@ jest.mock( 'wcpay/data', () => ( { } ) ), } ) ); +jest.mock( '@wordpress/data', () => ( { + createRegistryControl: jest.fn(), + dispatch: jest.fn( () => ( { + setIsMatching: jest.fn(), + onLoad: jest.fn(), + } ) ), + registerStore: jest.fn(), + select: jest.fn(), + useDispatch: jest.fn( () => ( { + createErrorNotice: jest.fn(), + } ) ), + useSelect: jest.fn( () => ( { getNotices: jest.fn() } ) ), + withDispatch: jest.fn( () => jest.fn() ), + withSelect: jest.fn( () => jest.fn() ), +} ) ); + const mockUseAuthorization = useAuthorization as jest.MockedFunction< typeof useAuthorization >;