Skip to content

Commit ea06274

Browse files
committed
Remove adobe commerce client test.
1 parent c6e8b70 commit ea06274

File tree

1 file changed

+0
-70
lines changed

1 file changed

+0
-70
lines changed

test/lib/adobe-commerce.test.js

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -21,76 +21,6 @@ const crypto = require('crypto');
2121
// eslint-disable-next-line node/no-unpublished-require
2222
const nock = require('nock');
2323

24-
describe('getAdobeCommerceClient', () => {
25-
beforeEach(() => {
26-
jest.clearAllMocks();
27-
});
28-
29-
describe('getAdobeCommerceClient', () => {
30-
const sharedParams = {
31-
COMMERCE_BASE_URL: 'http://mycommerce.com',
32-
LOG_LEVEL: 'debug',
33-
};
34-
test('with IMS auth', async () => {
35-
const params = {
36-
...sharedParams,
37-
OAUTH_CLIENT_ID: 'test-client-id',
38-
OAUTH_CLIENT_SECRETS: JSON.stringify(['supersecret']),
39-
OAUTH_TECHNICAL_ACCOUNT_ID: 'test-technical-account-id',
40-
OAUTH_TECHNICAL_ACCOUNT_EMAIL: '[email protected]',
41-
OAUTH_IMS_ORG_ID: 'test-org-id',
42-
OAUTH_SCOPES: JSON.stringify(['scope1', 'scope2']),
43-
};
44-
getToken.mockResolvedValue('supersecrettoken');
45-
const scope = nock(params.COMMERCE_BASE_URL)
46-
.get('/V1/testauth')
47-
.matchHeader('Content-Type', 'application/json')
48-
.matchHeader('x-ims-org-id', params.OAUTH_IMS_ORG_ID)
49-
.matchHeader('x-api-key', params.OAUTH_CLIENT_ID)
50-
.matchHeader('Authorization', 'Bearer supersecrettoken')
51-
.reply(200);
52-
53-
const client = await getAdobeCommerceClient(params);
54-
expect(getToken).toHaveBeenCalled();
55-
56-
const { success } = await client.get('testauth');
57-
expect(success).toBeTruthy();
58-
scope.done();
59-
});
60-
61-
test('with Commerce integration auth', async () => {
62-
const params = {
63-
...sharedParams,
64-
COMMERCE_CONSUMER_KEY: 'test-consumer-key',
65-
COMMERCE_CONSUMER_SECRET: 'test-consumer-secret',
66-
COMMERCE_ACCESS_TOKEN: 'test-access-token',
67-
COMMERCE_ACCESS_TOKEN_SECRET: 'test-access-token-secret',
68-
};
69-
70-
const scope = nock(params.COMMERCE_BASE_URL)
71-
.get('/V1/testauth')
72-
.matchHeader('Content-Type', 'application/json')
73-
.matchHeader(
74-
'Authorization',
75-
/^OAuth oauth_consumer_key="test-consumer-key", oauth_nonce="[^"]+", oauth_signature="[^"]+", oauth_signature_method="HMAC-SHA256", oauth_timestamp="[^"]+", oauth_token="test-access-token", oauth_version="1\.0"$/
76-
)
77-
.reply(200);
78-
79-
const client = await getAdobeCommerceClient(params);
80-
81-
const { success } = await client.get('testauth');
82-
expect(success).toBeTruthy();
83-
scope.done();
84-
});
85-
86-
test('throws when missing auth method', async () => {
87-
await expect(getAdobeCommerceClient(sharedParams)).rejects.toThrow(
88-
"Can't resolve authentication options for the given params."
89-
);
90-
});
91-
});
92-
});
93-
9424
describe('webhookVerify', () => {
9525
const { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', { modulusLength: 512 });
9626
const body = JSON.stringify({ test: 'data' });

0 commit comments

Comments
 (0)