Skip to content

Instantly share code, notes, and snippets.

@benmkramer
Created June 3, 2014 15:24
Show Gist options
  • Save benmkramer/a0aea9d478b8f24425f5 to your computer and use it in GitHub Desktop.
Save benmkramer/a0aea9d478b8f24425f5 to your computer and use it in GitHub Desktop.
var request = require('supertest');
var express = require('express');
var app = express();
app.get('/something', function (req, res) { res.send(200); });
it('should respond with 200', function (done) {
// PRODUCES DOUBLE CALLBACK
request(app)
.get('/something')
.expect(200, function (res) {
return false;
})
.end(done);
});
it('should also respond with 200', function (done) {
// DOES NOT PRODUCE DOUBLE CALLBACK
request(app)
.get('/something')
.expect(function (res) {
return false;
})
.expect(200, done);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment