I'm not sure if nock
is supporting awaiting or notifying using callback / event-emitter when the interceptor is called.
For example:
const scope = nock(config.research.url)
.post(config.research.routes.getOdds, expectBody)
.reply(200)
while(true){
expect(scope.isDone()).toBeTruthy()
await sleep(500)
}
My Question
How can I improve the above code using nock
API?
nock
emits event on request and response: https://github.com/nock/nock/#eventsYour code can listen to the
replied
event to get notified.