Skip to content

Instantly share code, notes, and snippets.

@lennym
Created April 9, 2015 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lennym/ada2f58f7b4190652325 to your computer and use it in GitHub Desktop.
Save lennym/ada2f58f7b4190652325 to your computer and use it in GitHub Desktop.
Example middleware test
var middleware = require('./my-middleware')
describe('middleware', function () {
var req, res;
beforeEach(function () {
req = {
session: { username: 'lennym' }
},
res = {}
});
it('adds a username property to the request', function (done) {
middleware(req, res, function (err) {
req.username.should.equal('lennym');
done(err);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment