When testing a simple express app / api I like to use supertest. This can feel like integration testing, and to an extent it is. But we can stub things out with sinon, and tidy up our tests. Let’s look at an example. Suppose we have a simple API with the following router: var express = require('express'), app = express(); var router = express.Router(); app.use('/', require('./router'));...
Stubbing middleware when testing an Express with Supertest
S