|
1 | 1 | /* global describe, test, expect, jest */ |
2 | 2 | import { renderHook } from '@testing-library/react'; |
3 | 3 | import { usePaymentConfig } from './usePaymentConfig'; |
4 | | -import { |
5 | | - CardFields, |
6 | | - CreditDebitCards, |
7 | | - DigitalWallets, |
8 | | -} from '../Components/PaymentOptions'; |
9 | | - |
10 | | -jest.mock( '../../../../data/onboarding', () => ( { |
11 | | - hooks: {}, |
12 | | - selectors: {}, |
13 | | - STORE_NAME: 'test/store', |
14 | | - initStore: jest.fn().mockReturnValue( true ), |
15 | | -} ) ); |
16 | 4 |
|
17 | 5 | jest.mock( '../../../../data', () => ( { |
18 | 6 | initStores: jest.fn(), |
19 | 7 | } ) ); |
20 | 8 |
|
21 | | -jest.mock( '@wordpress/i18n', () => ( { |
22 | | - __: ( text ) => text, |
23 | | -} ) ); |
24 | | - |
25 | | -jest.mock( '@wordpress/element', () => ( { |
26 | | - useMemo: ( callback ) => callback(), |
27 | | - useEffect: ( callback ) => callback(), |
28 | | - useState: ( initialState ) => [ initialState, jest.fn() ], |
29 | | - createContext: () => ( { |
30 | | - Provider: ( { children } ) => children, |
31 | | - Consumer: ( { children } ) => children, |
32 | | - } ), |
33 | | - forwardRef: ( Component ) => Component, |
34 | | - Fragment: ( { children } ) => children, |
35 | | -} ) ); |
36 | | - |
37 | | -jest.mock( '@wordpress/data', () => ( { |
38 | | - useDispatch: () => ( {} ), |
39 | | - useSelect: () => ( {} ), |
40 | | - createReduxStore: () => ( {} ), |
41 | | - register: () => {}, |
42 | | - select: () => ( {} ), |
43 | | -} ) ); |
44 | | - |
45 | | -jest.mock( '@wordpress/compose', () => ( { |
46 | | - createHigherOrderComponent: () => ( Component ) => Component, |
47 | | - withInstanceId: ( Component ) => Component, |
48 | | -} ) ); |
49 | | - |
50 | | -jest.mock( '@wordpress/components', () => ( { |
51 | | - Button: ( { children, ...props } ) => ( |
52 | | - <button { ...props }>{ children }</button> |
53 | | - ), |
54 | | -} ) ); |
55 | | - |
56 | | -jest.mock( '@wordpress/primitives', () => ( { |
57 | | - SVG: ( { children, ...props } ) => <svg { ...props }>{ children }</svg>, |
58 | | - Path: ( props ) => <path { ...props } />, |
59 | | -} ) ); |
60 | | - |
61 | | -jest.mock( '../../../../utils/countryInfoLinks', () => ( { |
62 | | - learnMoreLinks: { |
63 | | - US: { PayWithPayPal: 'https://example.com' }, |
64 | | - GB: { PayWithPayPal: 'https://example.com' }, |
65 | | - AU: { PayWithPayPal: 'https://example.com' }, |
66 | | - MX: { PayWithPayPal: 'https://example.com' }, |
67 | | - }, |
68 | | -} ) ); |
69 | | - |
70 | 9 | const EXPECTED_PAYMENT_METHODS = [ |
71 | 10 | [ |
72 | 11 | 'US', |
|
0 commit comments