How to use the nock.cleanAll function in nock

To help you get started, we’ve selected a few nock examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Paratii-Video / paratii-js / test / utils.js View on Github external
const mockDb = function () {
  const vids = vidsFixture
  const search = searchVidsFixture
  nock.cleanAll()
  nock.enableNetConnect()
  nock('https://db.paratii.video')
    .persist()
    .get('/api/v1/videos/some-id')
    .reply(200, vids[0])
    .get('/api/v1/videos/id-2')
    .reply(200, vids[1])
    .get('/api/v1/videos/id-3')
    .reply(200, vids[2])
    .get('/api/v1/videos/?owner=0xCbe4f07b343171ac37055B25a5266f48f6945b7d')
    .reply(200, search)
}
github bbc / http-transport / test / client.js View on Github external
function nockRetries(retry, opts) {
  const httpMethod = _.get(opts, 'httpMethod') || 'get';
  const successCode = _.get(opts, 'successCode') || 200;

  nock.cleanAll();
  api[httpMethod](path)
    .times(retry)
    .reply(500);
  api[httpMethod](path).reply(successCode);
}
github selenodium / selenodium-grid / test / proxy.js View on Github external
function resetStub() {
    nock.cleanAll();
}
github shoutem / redux-io / test / actions / update.spec.js View on Github external
afterEach(() => {
    nock.cleanAll();
    mockStore = configureMockStore(middlewares);
  });
github Netflix / pollyjs / packages / @pollyjs / adapter-node-http / src / index.js View on Github external
onDisconnect() {
    nock.cleanAll();
    nock.restore();
    this.NativeClientRequest = null;
  }
github DXHeroes / dx-scanner / src / services / git / Git.spec.ts View on Github external
beforeEach(() => {
    service.purgeCache();
    nock.cleanAll();
  });