describe('Requests tests', function () { it('Should return promise', function () { http.request.mockImplementation(mockedResponse) https.request.mockImplementation(mockedResponse) const promise = req.post(httpUrl, httpOptions.headers['Content-Type'], {}, testData) expect(typeof promise).toBe('object') expect(typeof promise.then).toBe('function') expect( http.request.mock.calls[0][0] ).toEqual(httpOptions) req.post(leanUrl, httpOptions.headers['Content-Type'], testData) expect( https.request.mock.calls[0][0].port ).toEqual(httpsPort) req.post(leanUrl2, httpOptions.headers['Content-Type'], testData) expect( http.request.mock.calls[1][0].port ).toEqual(httpPort) }) it('Should be able to run https and http', () => { const promise = req.post(httpsUrl, httpsOptions.headers['Content-Type'], {}, testData) expect(typeof promise).toBe('object') }) })