Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
}
afterEach(() => {
nock.cleanAll();
})
after(() => {
nock.cleanAll();
});
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);
}
const destroyNock = () => nock.cleanAll();
afterEach(() => nock.cleanAll());
function resetStub() {
nock.cleanAll();
}
afterEach(() => {
nock.cleanAll();
mockStore = configureMockStore(middlewares);
});
onDisconnect() {
nock.cleanAll();
nock.restore();
this.NativeClientRequest = null;
}
beforeEach(() => {
service.purgeCache();
nock.cleanAll();
});