1 import { render, screen } from '@testing-library/react';
3 import { type AvailablePaymentMethod, PAYMENT_METHOD_TYPES } from '@proton/payments';
4 import { buildUser } from '@proton/testing/builders';
6 import { type MethodsHook } from '../../payments/react-extensions';
7 import Checkout, { type Props } from './Checkout';
14 onChangeCurrency: jest.fn(),
15 children: <div>children</div>,
16 renewNotice: <div>renewNotice</div>,
20 selectedMethod: undefined,
25 lastUsedMethod: undefined,
26 savedInternalSelectedMethod: undefined,
27 savedExternalSelectedMethod: undefined,
28 savedSelectedMethod: undefined,
29 selectMethod: jest.fn(),
30 getSavedMethodByID: jest.fn(),
32 savedMethods: undefined,
34 isMethodTypeEnabled: jest.fn(),
39 it('should render', () => {
40 render(<Checkout {...props} />);
42 expect(screen.getByText('Summary')).toBeInTheDocument();
45 it('should disable currency selector when loading', () => {
46 render(<Checkout {...props} loading={true} />);
48 expect(screen.getByTestId('currency-selector')).toBeDisabled();
51 it('should disable currency selector when selected method is SEPA', () => {
52 props.paymentMethods.selectedMethod = {
53 type: PAYMENT_METHOD_TYPES.CHARGEBEE_SEPA_DIRECT_DEBIT,
56 } as AvailablePaymentMethod;
58 render(<Checkout {...props} />);
60 expect(screen.getByTestId('currency-selector')).toBeDisabled();