Mocked next?
OmgImAlexis opened this issue · comments
Alexis Tyler commented
What's the recommended way to handle routes that use next
for error handling?
Alexandra Deas commented
@OmgImAlexis You should be able to just drop in a spy
/stub
to mock next as the function doesn't have any functionality that's local to the middleware. Instead it notifies express to call the next RequestHandler
or ErrorRequestHandler
Dana Woodman commented
@alex-deas is correct, just create a const next = sinon.mock()
or whatever and pass it in!