Skip to content

Instantly share code, notes, and snippets.

@AhmedCommando
Created July 6, 2019 12:02
Show Gist options
  • Save AhmedCommando/3b73f0ea37e27b032bad5d7905af8688 to your computer and use it in GitHub Desktop.
Save AhmedCommando/3b73f0ea37e27b032bad5d7905af8688 to your computer and use it in GitHub Desktop.
helloWorld test using mocha/chai and supertest
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