Skip to content

Instantly share code, notes, and snippets.

@nkpremices
Created May 28, 2019 13:33
Show Gist options
  • Save nkpremices/0e581983f6cebc4c54e36265bc77f7ae to your computer and use it in GitHub Desktop.
Save nkpremices/0e581983f6cebc4c54e36265bc77f7ae to your computer and use it in GitHub Desktop.
A testing file for the presims micro session
const chai = require('chai');
const chaiHttp = require('chai-http');
const app = require('../index');
chai.use(chaiHttp);
describe('404 and forward to error handler', function () {
it('Should return an object', function(done) {
chai
.request(app)
.get('/')
.end((err, res) => {
res
.should
.have
.status(404);
res
.body
.should
.have
.property('errors')
.which
.has
.property('message', 'Not Found');
done();
});
});
});
@bdushimi
Copy link

Looks fine but you could do much better by having a test case description matching exactly what you're asserting. For instance, the test case did not mention the return on an object with a message 'Not Found'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment