Skip to content

Commit 828b988

Browse files
feat(payment): PAYPAL-5717 Added AppSwitch to PPCP button strategy
1 parent f2be41a commit 828b988

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

packages/paypal-commerce-integration/src/paypal-commerce/paypal-commerce-button-strategy.spec.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
getBuyNowCart,
1212
getBuyNowCartRequestBody,
1313
getCart,
14+
getConfig,
1415
getConsignment,
1516
getShippingOption,
1617
PaymentIntegrationServiceMock,
@@ -101,6 +102,8 @@ describe('PayPalCommerceButtonStrategy', () => {
101102
type: 'type_shipping',
102103
};
103104

105+
const storeConfig = getConfig().storeConfig;
106+
104107
beforeEach(() => {
105108
buyNowCart = getBuyNowCart();
106109
cart = getCart();
@@ -487,6 +490,18 @@ describe('PayPalCommerceButtonStrategy', () => {
487490

488491
describe('#createOrder', () => {
489492
it('creates paypal order', async () => {
493+
jest.spyOn(
494+
paymentIntegrationService.getState(),
495+
'getStoreConfigOrThrow',
496+
).mockReturnValue({
497+
...storeConfig,
498+
checkoutSettings: {
499+
...storeConfig.checkoutSettings,
500+
features: {
501+
'PAYPAL-5716.app_switch_functionality': false,
502+
},
503+
},
504+
});
490505
await strategy.initialize(initializationOptions);
491506

492507
eventEmitter.emit('createOrder');
@@ -495,10 +510,6 @@ describe('PayPalCommerceButtonStrategy', () => {
495510

496511
expect(paypalCommerceIntegrationService.createOrder).toHaveBeenCalledWith(
497512
'paypalcommerce',
498-
{
499-
userAgent:
500-
'Mozilla/5.0 (darwin) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/16.7.0',
501-
},
502513
);
503514
});
504515
});

0 commit comments

Comments
 (0)