Skip to content
Snippets Groups Projects
Commit 4e3bcab7 authored by João Victor Tozatti Risso's avatar João Victor Tozatti Risso
Browse files

Add basic test to check for invalid routes and the API is running

parent 488edaa5
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!27Implement UC201 - Select Location
process.env.NODE_ENV = 'test';
const chai = require('chai');
const dirtyChai = require('dirty-chai');
chai.use(dirtyChai);
const chaiXml = require('chai-xml');
chai.use(chaiXml);
const chaiHttp = require('chai-http');
const assert = chai.assert;
const expect = chai.expect;
const should = chai.should(); // actually call the function
const libs = `${process.cwd()}/libs`;
const server = require(`${libs}/app`);
chai.use(chaiHttp);
describe('API is running', () => {
it('should respond it\'s running', (done) => {
chai.request(server)
.get('/api/v1')
.end((err, res) => {
res.should.have.status(200);
res.should.be.json;
res.body.should.have.property('msg');
done();
})
});
it('should respond with 404 error', (done) => {
chai.request(server)
.get('/api/v1/thisrouteshouldgivea404')
.end((err, res) => {
res.should.have.status(200);
res.should.be.json;
res.body.should.have.property('msg');
done();
})
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment