doesError(mockName, funcName, dataToReturn)

This is a variant of 'doesReturn'. Defines what to return during a failure scenario from a synchronous mocked function. To force the error scenario, the mocked function will throw the dataToReturn. Best practice dictates that you only throw Javascript Error objects. Therefore, you should be providing a Node Error object in the dataToReturn property.

  • 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 {Error} - The Error object to be thrown.
  • returns {Scenario}