asyncFn for sinon provides additional methods to sinon.spy to introduce "late resolve" for the promises returned.
This simplifies async unit testing by allowing tests that read chronologically, like a story, and do not require excessive test setup to know beforehand how async mocks are supposed to behave in each scenario.
asyncFn has zero non-native dependencies. It has 100% unit test coverage, and 3+ years of focused production use with high developer satisfaction.
asyncFn is also integration-tested for combinations of recent OS-, node- and mocking framework -versions.
How to install
$ npm install --save-dev @asyncFn/sinon
See tutorial here.
Late resolve for calls to a mock to make tests read like a story
Late resolve for multiple calls to a mock
Awaiting for coincidences of resolved calls
The other stuff sinon.spy does
Check out the unit tests.
Currently asyncFn is also available for jest.
Who are we?
asyncFn is lovingly crafted by Your pals at Team: Igniter from Houston Inc. Consulting.
We are a software development team of friends, with proven tradition in professional excellence. We specialize in holistic rapid deployments without sacrificing quality.