Closed Ellisande closed 8 years ago
Feature
Add an easy mechanism for mockFunction to return promises.
It'll make life easier for people mocking functions that return promises.
Proposed example:
mockFunc.when(1).thenPromise.toReturn(2); const myPromise = mockFunc(1); myPromise.then(result => console.log(result)); //Result would be 2 mockFunc.when(2).thenPromise.toThrow(new Error('Die')) const myPromise = mockFunc(1); myPromise.catch(err => console.log(err.message)); //Would log 'Die'
What kind of issue is this? (bug, feature, etc)
Feature
What is the proposed change?
Add an easy mechanism for mockFunction to return promises.
Why will this be beneficial?
It'll make life easier for people mocking functions that return promises.
Misc. info
Proposed example: