Skip to content

Commit

Permalink
feat(payment): PI-3048 [Checkout.com] add test for experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
bc-ania committed Jan 14, 2025
1 parent 5d34da0 commit 9f82314
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe('when using Checkoutcom payment', () => {
let defaultProps: PaymentMethodProps;
let localeContext: LocaleContextType;
let fawryMethod: PaymentMethod;
let idealMethod: PaymentMethod;
let alternateMethodA: PaymentMethod;
let alternateMethodB: PaymentMethod;
let PaymentMethodTest: FunctionComponent<PaymentMethodProps>;
Expand Down Expand Up @@ -72,7 +73,11 @@ describe('when using Checkoutcom payment', () => {
id: 'fawry',
gateway: PaymentMethodId.Checkoutcom,
};

idealMethod = {
...getPaymentMethod(),
id: 'ideal',
gateway: PaymentMethodId.Checkoutcom,
};
alternateMethodA = {
...getPaymentMethod(),
id: 'oxxo',
Expand Down Expand Up @@ -217,4 +222,21 @@ describe('when using Checkoutcom payment', () => {

expect(defaultProps.onUnhandledError).toHaveBeenCalled();
});

it('does not render CreditCardPaymentComponent when ideal experiment is on', () => {
jest.spyOn(checkoutState.data, 'getConfig').mockReturnValue({
...getStoreConfig(),
checkoutSettings: {
...getStoreConfig().checkoutSettings,
features: {
...getStoreConfig().checkoutSettings.features,
'PI-2979.checkoutcom_enable_ideal_hosted_page': true,
},
},
});

const { container } = render(<PaymentMethodTest {...defaultProps} method={idealMethod} />);

expect(container.firstChild).toBeNull();
});
});

0 comments on commit 9f82314

Please sign in to comment.