// @ts-nocheck import { expect } from 'chai'; import * as sinon from 'sinon'; import * as proxyquire from 'proxyquire'; const strictProxy = proxyquire.noCallThru(); const sandbox = sinon.createSandbox(); describe('requestDelete', () => { let makeRequestStub; let requestDeleteStub; let url; let options; let getHeadersStub; beforeEach(async () => { makeRequestStub = sandbox.stub(); getHeadersStub = sandbox.stub(); requestDeleteStub = strictProxy('../../../src/request/delete', { './make-request': { makeRequest: makeRequestStub }, }).requestDelete; await requestDeleteStub({ url: 'https://example.com', key: 'secretKey' }); url = makeRequestStub.getCall(0).args[0]; options = makeRequestStub.getCall(0).args[1]; }); it('calls makeRequest with url set to https://example.com', async () => { expect(url).to.equal('https://example.com'); }); it('calls makeRequest with method set to DELETE', async () => { expect(options.method).to.equal('DELETE'); }); it('calls makeRequest with key is set to secretKey', async () => { expect(options.headers['X-api-key']).to.equal('secretKey'); }); it('calls makeRequest with contentType is set to application/json', async () => { expect(options.headers['Content-Type']).to.equal('application/json'); }); });