Last active
June 9, 2019 21:25
-
-
Save tolulope-od/d1569802504437ba91ee68d97c4eb602 to your computer and use it in GitHub Desktop.
Testing a NodeJS API server root URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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