@2012-11-29 @night of node
function copy(from) {
var to = {};
for (var key in from) {
to[key] = from[key];
}
return to;
}
app.use(function (req, res, next) {
//do some thing
});
var app = express();
app.get('/user', function(req, res){
res.send(201, { name: 'tobi' });
});
describe('GET /users', function() {
it('respond with json', function(done){
request(app)
.get('/user')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200, done);
});
});
describe('GET /users', function() {
it('respond with json', function(done){
request(app)
.get('/user')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(/body content 1/)
.expect(/body content 2/)
.expect(200, done);
});
});
/
#