Skip to content

Instantly share code, notes, and snippets.

@tolulope-od
Last active June 9, 2019 21:25
Show Gist options
  • Save tolulope-od/d1569802504437ba91ee68d97c4eb602 to your computer and use it in GitHub Desktop.
Save tolulope-od/d1569802504437ba91ee68d97c4eb602 to your computer and use it in GitHub Desktop.
Testing a NodeJS API server root URL
// Import the testing dependencies
import chai from 'chai';
import chaiHttp from 'chai-http';
import app from '../../';
describe('App Root', () => {
it('should return status 200 and a message attribute', (done) => {
chai.request(app)
.get('/')
.end((err, res) => {
const { message } = res.body;
expect(res).to.have.status(200);
expect(message).to.deep.equal('Hello Books');
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment