How to use the restore function from nock

Find comprehensive JavaScript nock.restore code examples handpicked from public code repositorys.

2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
  nock.disableNetConnect();
});

// after the tests, re-enable network connections
after(() => {
  nock.restore();
  nock.enableNetConnect();
});

// before each test, setup the commonly used data
fork icon14
star icon34
watch icon9

+ 19 other calls in file

117
118
119
120
121
122
123
124
125

  if (this.#stack.length) {
    this[_saveState](this.#stack[this.#stack.length - 1])
  }

  nock.restore()
  nock.activate()
  this.#state = PAUSED
}
fork icon3
star icon5
watch icon7

+ 3 other calls in file

196
197
198
199
200
201
202
203
204
205
  transactionDataCopy = JSON.parse(JSON.stringify(testdata.getTransaction()));
  unspentDataCopy = JSON.parse(JSON.stringify(testdata.listUnspent()));
});

beforeEach(() => nock.cleanAll());
afterAll(() => nock.restore());
beforeAll(() => {
  if (!nock.isActive()) nock.activate();
  nock.enableNetConnect();
});
fork icon6
star icon1
watch icon0