Skip to content

Commit

Permalink
chore(test): moving testdata to sandbox to run in public domain
Browse files Browse the repository at this point in the history
  • Loading branch information
Ratnadeep Simhadri committed Nov 10, 2022
1 parent ccbd4f1 commit 3f47f37
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions src/__tests__/applepay.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import { Applepay } from '../applepay';
import { getMerchantDomain } from '../util';

jest.mock('@paypal/sdk-client/src', () => ({
getClientID: () => 'AfALq_mQ3SUUltuavn8MnEaXPCPFRl4aOZDTcDTo1I4FsJGN3TPFZ1THvcT39wAF3S250a5oqCUbpJHH',
getMerchantID: () => [ 'HZZ2RQHJM4CE6' ],
getPayPalAPIDomain: () => 'https://api.msmaster.qa.paypal.com',
getPayPalDomain: () => 'https://www.msmaster.qa.paypal.com',
getClientID: () => 'AdVrVyh_UduEct9CWFHsaHRXKVxbnCDleEJdVOZdb52qSjrWkKDNd6E1CNvd5BvNrGSsXzgQ238dGgZ4',
getMerchantID: () => [ '2V9L63AM2BYKC' ],
getPayPalAPIDomain: () => 'https://cors.api.sandbox.paypal.com',
getPayPalDomain: () => 'https://www.sandbox.paypal.com',
getBuyerCountry: () => 'US',
getLogger: () => ({
info: () => ({
Expand Down Expand Up @@ -45,7 +45,7 @@ jest.mock('../util', () => {
__esModule: true,
...originalModule,
getMerchantDomain: jest.fn(),
getPayPalHost: () => 'msmaster.qa.paypal.com'
getPayPalHost: () => 'paypal.com'
};
});

Expand All @@ -69,7 +69,7 @@ describe('applepay', () => {
value: '1.00'
},
payee: {
merchant_id: 'HZZ2RQHJM4CE6'
merchant_id: '2V9L63AM2BYKC'
}
}
]
Expand Down Expand Up @@ -112,7 +112,7 @@ describe('applepay', () => {

try {
await applepay.validateMerchant({
validationUrl: 'https://apple-pay-gateway-cert.apple.com/paymentservices/startSession',
validationUrl: 'https://apple-pay-gateway-cert.apple.com/paymentservices/startSession'
});
} catch (err) {
expect(err.name).toBe('PayPalApplePayError');
Expand All @@ -125,14 +125,14 @@ describe('applepay', () => {
it('should validate a valid url', async () => {
const applepay = Applepay();

getMerchantDomain.mockReturnValueOnce('stage-applepay-paypal-js-sdk.herokuapp.com');
getMerchantDomain.mockReturnValueOnce('sandbox-applepay-paypal-js-sdk.herokuapp.com');

// eslint-disable-next-line flowtype/no-weak-types
const response : any = await applepay.validateMerchant({
validationUrl: 'https://apple-pay-gateway-cert.apple.com/paymentservices/startSession',
validationUrl: 'https://apple-pay-gateway-cert.apple.com/paymentservices/startSession'
});

expect(response.merchantSession.displayName).toEqual('Demo Inc.');
expect(response.merchantSession.displayName).toEqual('Custom Clothing');
expect(response.merchantSession.signature).toEqual(expect.any(String));
expect(response.merchantSession.nonce).toEqual(expect.any(String));
expect(response.paypalDebugId).toEqual(expect.any(String));
Expand All @@ -141,12 +141,12 @@ describe('applepay', () => {
it('should accept an optional display name for the apple pay button', async () => {
const applepay = Applepay();

getMerchantDomain.mockReturnValueOnce('stage-applepay-paypal-js-sdk.herokuapp.com');
getMerchantDomain.mockReturnValueOnce('sandbox-applepay-paypal-js-sdk.herokuapp.com');

// eslint-disable-next-line flowtype/no-weak-types
const response : any = await applepay.validateMerchant({
validationUrl: 'https://apple-pay-gateway-cert.apple.com/paymentservices/startSession',
displayName: 'Custom Business Name'
displayName: 'Custom Business Name'
});

expect(response.merchantSession.displayName).toEqual('Custom Business Name');
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Object.defineProperty(window, 'location', {
});

jest.mock('@paypal/sdk-client/src', () => ({
getPayPalDomain: () => 'https://paypal.com',
getMerchantID: () => 'HZZ2RQHJM4CE6',
getPayPalDomain: () => 'https://www.sandbox.paypal.com',
getMerchantID: () => '2V9L63AM2BYKC',
getBuyerCountry: () => 'US',
getSDKQueryParam: (param) => {
if (param === 'currency') {
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('util', () => {
value: '0.99'
},
payee: {
merchant_id: 'HZZ2RQHJM4CE6'
merchant_id: '2V9L63AM2BYKC'
}
}
],
Expand Down Expand Up @@ -93,7 +93,7 @@ describe('util', () => {
value: '0.99'
},
payee: {
merchant_id: 'HZZ2RQHJM4CE6'
merchant_id: '2V9L63AM2BYKC'
}
}
],
Expand Down

0 comments on commit 3f47f37

Please sign in to comment.