Created
July 6, 2019 12:02
-
-
Save AhmedCommando/3b73f0ea37e27b032bad5d7905af8688 to your computer and use it in GitHub Desktop.
helloWorld test using mocha/chai and supertest
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 { expect } from 'chai'; | |
import { agent as request } from 'supertest'; | |
import 'mocha'; | |
import App from '../src/index'; | |
describe('baseRoute', () => { | |
it('should GET', async () => { | |
const res = await request(App).get('/'); | |
// we check the status | |
expect(res.status).to.equal(200); | |
// we check the return type | |
expect(res.type).to.equal('application/json'); | |
// we check the body message | |
expect(res.body.message).to.equal('Hello World!'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment