Skip to content

Commit

Permalink
Update client.spec.js
Browse files Browse the repository at this point in the history
  • Loading branch information
shrutiburman committed Nov 19, 2023
1 parent 100ea93 commit 0f1f90c
Showing 1 changed file with 12 additions and 22 deletions.
34 changes: 12 additions & 22 deletions packages/client/src/client.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
const nock = require('nock');
const sgClient = require('./client');

const testRequest = (request, statusCode) => {
const sgClient = require('./client');
sgClient.setApiKey('SG.API Key');
sgClient.setDefaultHeader('X-Mock', statusCode);
return sgClient
.request(request)
.then(([response, body]) => {
expect(response.statusCode).to.equal(statusCode);
});
};

describe('client', () => {
const sgClient = require('./client');
Expand All @@ -26,6 +16,18 @@ describe('client', () => {
nock.cleanAll();
});


describe('setDataResidency', () => {
const testClient = require('./client');
testClient.setDataResidency('eu');
console.log(testClient);
console.log('Actual:', testClient.defaultRequest.baseUrl);
it('should have hostname as global', () => {
console.log(testClient);
expect(testClient.defaultRequest.baseUrl).to.equal('api.eu.sendgrid.com');
});
});

describe('setApiKey', () => {
it('should not log a warning for a proper API key value', () => {
sgClient.setApiKey('SG.1234567890');
Expand Down Expand Up @@ -3092,15 +3094,3 @@ describe('test_whitelabel_links__link_id__subuser_post', () => {
return testRequest(request, 200);
});
});

describe('setDataResidency', () => {
const testClient = require('./client');
testClient.setDataResidency('eu');
console.log(testClient);
console.log('Actual:', testClient.defaultRequest.baseUrl);

it('should have hostname as global', () => {
console.log(testClient);
expect(testClient.defaultRequest.baseUrl).to.equal('api.eu.sendgrid.com');
});
});

0 comments on commit 0f1f90c

Please sign in to comment.