doesReturnWithPromise(mockName, funcName, dataToReturn)
This is a variant of 'doesReturn'. It defines what to return from a mocked function during a success scenario that returns a promise.
Every 'shouldBeCalledWith' or any of its variants need to be matched with a 'doesReturn' or one of its variants. Why? For every mocked function, we test that it is called with the expected, and then return something from the mocked function to continue driving the scenario through your code.
Ordering matters when defining the response from mocked functions. The first time your mock is called, Maddox will return the response of the first defined response from 'doesReturn' or one of its variants.
- mockName {String} - This is the key for the mock. It should match the key from 'mockThisFunction'.
- funcName {String} - The name of the function to be mocked. Should match the name from 'mockThisFunction'.
- dataToReturn {Any} - The data that will be returned when this mocked function is executed. This data will be available in the next step of your promise chain.
- returns {Scenario}