// @ts-nocheck import { expect } from 'chai'; import * as sinon from 'sinon'; import * as proxyquire from 'proxyquire'; import { head } from '../../../src/request/head'; const strictProxy = proxyquire.noCallThru(); const key = 'secret'; const url = 'https://example.com/'; describe('Head request', () => { let mockFetchRequest; beforeEach(() => { const sandbox = sinon.createSandbox(); mockFetchRequest = sandbox.stub().resolves({ ok: true }); }); it('checks fetch calls with the correct url string and options object', () => { const options = { method: 'HEAD', headers: { 'X-api-key': key } }; head({ key, url }, mockFetchRequest); expect(mockFetchRequest.calledWith(url, options)).to.eql(true); }); it('returns full response when there is no network error', async () => { const request = await head({ key, url }, mockFetchRequest); expect(request).to.eql({ ok: true }); }); });