1.0.6 • Published 3 years ago

mock-https v1.0.6

Weekly downloads
13
License
ISC
Repository
github
Last release
3 years ago

mock-https


Simple library for mocking https calls inside of tests.
Works by using sinon to mock out https library.

https://www.npmjs.com/package/mock-https

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);
  });
});
1.0.6

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago