🔗 td-chain
If you use testdouble.js, you might have run into a bit of difficulty mocking chained APIs. In most cases, you should probably just avoid the problem. If you're sure you want to do this, td-chain should help a little.
Installation
npm install td-chain
Usage
Say you have a module ./test/subject
that calls ./my/api
like this:
module { return next'more args' // returns 42}
You can mock out the call to api()
like this:
const td = const chain = const api = tdconst result = Symbol td const subject =
For comparison, without td-chain:
const td = const api = tdconst td2 = tdconst td3 = td const result = Symbol td td td const subject =