From 15d99c24b2cedde26573386ee6ce61fc3053ab83 Mon Sep 17 00:00:00 2001 From: sburman Date: Mon, 20 Nov 2023 13:03:34 +0530 Subject: [PATCH] Update client.spec.js --- packages/client/src/client.spec.js | 60 +++++------------------------- 1 file changed, 9 insertions(+), 51 deletions(-) diff --git a/packages/client/src/client.spec.js b/packages/client/src/client.spec.js index d7508177..3e58657c 100644 --- a/packages/client/src/client.spec.js +++ b/packages/client/src/client.spec.js @@ -14,17 +14,6 @@ const testRequest = (request, statusCode) => { }); }; -const testRequestWithClient = (request, statusCode) => { - const testClient = require('./client'); - testClient.setDefaultHeader('X-Mock', statusCode); - testClient.setDataResidency('eu'); - return testClient - .request(request) - .then(([response, body]) => { - expect(response.statusCode).to.equal(statusCode); - }); -}; - describe('client', () => { const sgClient = require('./client'); let consoleWarnSpy; @@ -3108,46 +3097,15 @@ describe('test_whitelabel_links__link_id__subuser_post', () => { describe('test client', () => { const testClient = require('./client'); - // describe('setDataResidency', () => { - // testClient.setDataResidency('eu'); - // console.log("before: "); - // 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'); - // }); - // }); - it('should test', () => { - const request = { - body: { - content: [ - { - type: 'text/plain', - value: '#'.repeat(1024 * 1024 * 10), // 10 MB, - }, - ], - from: { - email: 'me@you.com', - }, - subject: 'Hello, World!', - }, - method: 'POST', - url: '/v3/mail/send', - }; - - return testRequestWithClient(request, 202); - }); - it('should send requests to the hostname', () => { - const scope = nock('https://api.eu.sendgrid.com') - .matchHeader('Authorization', /^Bearer SG\.1234567890$/) - .get('/') - .reply(200, 'test response'); - - sgClient.setDataResidency('eu'); - - return sgClient.request({}) - .then(() => scope.done()); + describe('setDataResidency', () => { + testClient.setDataResidency('eu'); + console.log('before: '); + 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'); + }); }); });