0

I am looking for a way to be able to specify which nock request will be called for each mocha test. The issue is that I have ~50 nock request all with the same exact url (post data differs) and it makes using skip() and only() in mocha a huge pain. I am thinking of using headers to differentiate. Is there a better option?

cyberwombat
  • 38,105
  • 35
  • 175
  • 251

1 Answers1

0

If you call nock for the individual test you can reuse URLs for that test. If it's the same URL you can set it as a variable to save some typing too.

var url = "http://example.com";
it("should test something", function () {
    nock(url).post;
});
it("should test another thing", function () {
    nock(url).post;
});
Explosion Pills
  • 188,624
  • 52
  • 326
  • 405