mock-https
v1.1.0
Published
Simple library for mocking https calls inside of tests
Downloads
10
Readme
mock-https
Simple library for mocking https calls inside of tests.
Works by using sinon
to mock out https
library.
Example test class utilizing mock-https
const mockhttps = require('mock-https');
let mockDataReturnedFromGet = "...";
afterEach(function() {
mockhttps.reset();
});
describe('description of test', () => {
it('should blah blah', async () => {
mockhttps.expectGet('https://www.url.com/something.json?limit=5', mockDataReturnedFromGet);
const result = await SomeClass.methodThatUsesHttps();
assert.equal("", result);
});
});