How to use the nock.back.setMode 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 muxinc / mux-node-sdk / test / helper.js View on Github external
before(() => {
  nockBack.setMode(nockBack.currentMode);
  // If we decide to use nock with other modules we should move this to a test helper
  nockBack.fixtures = path.join(__dirname, '/nockFixtures');
});
github drewcummins / hodlol / test / test-kucoin.js View on Github external
var expect = require('chai').expect;
let kucoin = require('../app/client/kucoin');
var nockBack = require('nock').back;

nockBack.fixtures = './test/fixtures/';
nockBack.setMode('record');

describe('Kucoin init', function() {
  it('should initialize properly', function() {
    expect(kucoin.exchange).to.equal("Kucoin");
  });
});

describe('Kucoin.getTicker()', function() {
  it('should get ticker value', function() {

    return nockBack('kucoin-ticker.json')
    .then(async ({nockDone, context}) => {
      const coin = "VEN";
      const market = "BTC"
      const pair = `${coin}-${market}`;
      const res = await kucoin.getTicker(pair);
github ewnd9 / media-center / test / helpers / nock.js View on Github external
const beforeFn = () => {
    nockBack.setMode('record');
    nockBack(fixtureName, options, callback => nockDone = callback);
  };