mardi 31 juillet 2018

Testing Express Middleware next('This is my Error Message')

Trying to test a middleware in Express that under some conditions calls next('my error message') and triggers an error. How it is possible to test this middleware in isolation? I'm seeing some good libraries for stubbing res and req but nothing for next. The behavior of triggering an error when passing a string to next needs to be available for this test to work

Aucun commentaire:

Enregistrer un commentaire