Skip to content

Commit

Permalink
Mock @wordpress/data to fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinksi committed Sep 28, 2023
1 parent 7f24785 commit 8a6166c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions client/payment-details/summary/test/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
>;
Expand Down

0 comments on commit 8a6166c

Please sign in to comment.