Skip to content

Instantly share code, notes, and snippets.

@Mcdavid95
Created February 1, 2019 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mcdavid95/ad0807ff02a2ff4f8489bc508856b756 to your computer and use it in GitHub Desktop.
Save Mcdavid95/ad0807ff02a2ff4f8489bc508856b756 to your computer and use it in GitHub Desktop.
const supertest = require('supertest');
const server = require('./index');
const chai = require('chai');
chai.should();
const api = supertest.agent(server);
describe('Add method', () => {
it('should connect to the Server', (done) => {
api.post('/api/add')
.set('Connetion', 'keep alive')
.set('Content-Type', 'application/json')
.type('form')
.send({
firstNumber: 2,
secondNumber: 3
})
.end((err, res) => {
res.status.should.equal(200);
res.body.result.should.equal(5);
done();
});
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment