Skip to content

Instantly share code, notes, and snippets.

@fiznool
Forked from silas/app.js
Last active August 29, 2015 14:01
Show Gist options
  • Save fiznool/0c9d32b1657228ef2cbd to your computer and use it in GitHub Desktop.
Save fiznool/0c9d32b1657228ef2cbd to your computer and use it in GitHub Desktop.
var express = require('express'),
app = express();
app.configure(function() {
app.use(express.bodyParser());
app.use(app.router);
});
app.get('/', function(req, res) {
res.send(500);
});
module.exports = app;
{
"name": "supertest-issue",
"version": "0.0.1",
"private": true,
"dependencies": {
"express": "3.x",
"expect": "^0.1.1",
"expect.js": "^0.3.1"
},
"devDependencies": {
"mocha": "*",
"supertest": "*"
},
"scripts": {
"test": "node_modules/mocha/bin/mocha ./test.js"
}
}
var request = require('supertest'),
expect = require('expect.js'),
app = require('./app');
describe('check status 500', function() {
it('is correct', function(done) {
request(app)
.get('/')
.expect(500, done);
});
it('is not correct', function(done) {
request(app)
.get('/')
.expect(404)
.end(function(err) {
expect(err).not.to.be(undefined);
done(err);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment