Problem:
I want to mock a situation in which on the same http call I get different results. Specifically, the first time it fails.
To some extent this is similar to Sinon capability of stub.onFirstCall()
, stub.onSecondCall()
Expectation:
I expected that if I use once
on the first call and twice
on the second call I would be able to accomplish the above.
nock( some_url )
.post( '/aaaa', bodyFn )
.once()
.reply( 500, resp );
nock( some_url )
.post( '/aaaa', bodyFn )
.twice()
.reply( 200, resp );