Skip to content

Instantly share code, notes, and snippets.

@badsyntax
Created April 9, 2014 15:26
Show Gist options
  • Save badsyntax/10283004 to your computer and use it in GitHub Desktop.
Save badsyntax/10283004 to your computer and use it in GitHub Desktop.
test.js
var request = require('supertest')
, express = require('express');
var app = express();
app.get('/user', function(req, res){
var name = '';
setTimeout(function() {
name = 'tobi';
}, 500);
setTimeout(function() {
res.send(200, { name: name });
}, 700);
});
describe('GET /users', function(){
it('respond with json', function(done){
request(app)
.get('/user')
.expect(200)
.end(function(err, res){
done();
});
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment