doesAlwaysReturnWithCallback(mockName, funcName, dataToReturn)
This is a variant of 'doesReturn'. It defines what to return from a mocked function during a success scenario that expects results to be returned in a callback. The dataToReturn will be returned on every execution of the mock. That means you only need to define one return value for all calls to the mock.
Maddox currently enforces a common paradigm for having the callback function be the last parameter. If you have a function that expects a callback, the callback must be the last parameter. Maddox will grab the callback from the last parameter and execute it with the provided dataToReturn.
The dataToReturn property for 'doesReturnWithCallback' needs to be an array to allow any any number parameters to be added in the callback function.
- 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 {Array} - An array of parameters that will be applied (.apply) to the provided callback function.
- returns {Scenario}