blog-it-stub
simple stub library used by blog-it tests
how to
API
when(service, methodName)
: create a stub and return itthenResolveWith(resolvedValue)
: tells the stub it should resolve with resolvedValuethenRejectWith(rejectValue)
: tells the stub it should reject the promise with rejectValueflush()
: effectively resolve/reject the stub (note it is anasynchronous operation
therefore you should put your assertion in the callback of the promisehasBeenResolved()
: tells whether the stub has been resolvedhasBeenRejected()
: tells whether the stub has been rejected
Test
run npm test
License
MIT