Commit 0c6f7d58 authored by Severine Duvaud's avatar Severine Duvaud
Browse files

Issue #2: Integration tests

parent 7ad71679
...@@ -18,5 +18,10 @@ ...@@ -18,5 +18,10 @@
"morgan": "~1.6.1", "morgan": "~1.6.1",
"serve-favicon": "~2.3.0", "serve-favicon": "~2.3.0",
"underscore": "^1.8.3" "underscore": "^1.8.3"
},
"devDependencies": {
"mocha": "^3.0.2",
"chai": "^3.2.0",
"chai-http": "^1.0.0"
} }
} }
// More functional test than Unit tests
// Error with the HTTP request to the API
// (empty object returned due to async)
var chai = require('chai');
var chaiHttp = require('chai-http');
var server = require('../app');
var should = chai.should();
chai.use(chaiHttp);
describe('Beacon arrayMap', function() {
it('should display the info page', function(done) {
chai.request(server)
.get('/info')
.end(function(err, res){
res.should.have.status(200);
res.should.be.json;
res.body.should.be.a('object');
res.should.not.be.empty;
res.should.have.property('info');
done();
});
});
it('should display the sample page, 10 first samples' , function(done) {
chai.request(server)
.get('/samples?limit=10')
.end(function(err, res){
res.should.have.status(200);
res.should.be.json;
res.body.should.be.a('array');
res.body.should.have.lengthOf(10);
res.body[0].should.have.property('_id');
res.body[0].should.have.property('DIAGNOSISTEXT');
done();
});
});
it('should display the query page' , function(done) {
chai.request(server)
.get('/v0.4/query')
.end(function(err, res){
res.should.have.status(200);
res.body.should.equal('reference name is not present');
done();
});
});
});
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment