Skip to content
Snippets Groups Projects
Commit 697d8ee8 authored by Hamer Iboshi's avatar Hamer Iboshi
Browse files

Improvment of tests in school routes

parent 124a2935
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!47School number count
Pipeline #
...@@ -540,45 +540,80 @@ describe('request schools count', () => { ...@@ -540,45 +540,80 @@ describe('request schools count', () => {
}); });
}); });
it('should list school with valid dimensions and filters related to library and reading_room of Curitiba', (done) => { it('should list school with valid dimensions and filters of states', (done) => {
chai.request(server) chai.request(server)
.get('/api/v1/school/count?dims=city,library,reading_room,library_reading_room&filter=min_year:2015,max_year:2016,city:4106902') .get('/api/v1/school/count?dims=state,education_professional,education_eja&filter=min_year:2015,max_year:2016')
.end((err, res) => { .end((err, res) => {
res.should.have.status(200); res.should.have.status(200);
res.should.be.json; res.should.be.json;
res.body.should.have.property('result'); res.body.should.have.property('result');
res.body.result.should.be.a('array'); res.body.result.should.be.a('array');
res.body.result[0].should.have.property('city_name'); res.body.result[0].should.have.property('state_name');
res.body.result[0].should.have.property('education_professional_name');
res.body.result[0].should.have.property('education_eja_name');
res.body.result[0].should.have.property('total'); res.body.result[0].should.have.property('total');
res.body.result[0].should.have.property('year'); res.body.result[0].should.have.property('year');
done(); done();
}); });
}); });
it('should list school with valid dimensions and filters related to library and reading_room of cities of Paraná', (done) => { it('should list school with valid dimensions and filters of states', (done) => {
chai.request(server) chai.request(server)
.get('/api/v1/school/count?dims=city,library,reading_room,library_reading_room&filter=min_year:2015,max_year:2016,state:41') .get('/api/v1/school/count?dims=state&filter=min_year:2015,max_year:2016')
.end((err, res) => { .end((err, res) => {
res.should.have.status(200); res.should.have.status(200);
res.should.be.json; res.should.be.json;
res.body.should.have.property('result'); res.body.should.have.property('result');
res.body.result.should.be.a('array'); res.body.result.should.be.a('array');
res.body.result[0].should.have.property('city_name'); res.body.result[0].should.have.property('state_name');
res.body.result[0].should.have.property('total'); res.body.result[0].should.have.property('total');
res.body.result[0].should.have.property('year'); res.body.result[0].should.have.property('year');
done(); done();
}); });
}); });
it('should list school with valid dimensions and filters related to library and reading_room of cities of Paraná', (done) => { it('should list school with valid dimensions and filters of states that have no toilet inside building', (done) => {
chai.request(server) chai.request(server)
.get('/api/v1/school/count?dims=city,library,reading_room,library_reading_room&filter=min_year:2015,max_year:2016,state:41') .get('/api/v1/school/count?dims=state&filter=min_year:2015,max_year:2016,toilet_inside_building:0')
.end((err, res) => {
res.should.have.status(200);
res.should.be.json;
res.body.should.have.property('result');
res.body.result.should.be.a('array');
res.body.result[0].should.have.property('state_name');
res.body.result[0].should.have.property('total');
res.body.result[0].should.have.property('year');
done();
});
});
it('should list school with valid dimensions and filters of states with energy and water', (done) => {
chai.request(server)
.get('/api/v1/school/count?dims=state&filter=min_year:2015,max_year:2016,energy:1,water:1')
.end((err, res) => {
res.should.have.status(200);
res.should.be.json;
res.body.should.have.property('result');
res.body.result.should.be.a('array');
res.body.result[0].should.have.property('state_name');
res.body.result[0].should.have.property('total');
res.body.result[0].should.have.property('year');
done();
});
});
it('should list school with valid dimensions and filters related to library and reading_room of Curitiba', (done) => {
chai.request(server)
.get('/api/v1/school/count?dims=city,library,reading_room,library_reading_room&filter=min_year:2015,max_year:2016,city:4106902')
.end((err, res) => { .end((err, res) => {
res.should.have.status(200); res.should.have.status(200);
res.should.be.json; res.should.be.json;
res.body.should.have.property('result'); res.body.should.have.property('result');
res.body.result.should.be.a('array'); res.body.result.should.be.a('array');
res.body.result[0].should.have.property('city_name'); res.body.result[0].should.have.property('city_name');
res.body.result[0].should.have.property('library_name');
res.body.result[0].should.have.property('reading_room_name');
res.body.result[0].should.have.property('library_reading_room_name');
res.body.result[0].should.have.property('total'); res.body.result[0].should.have.property('total');
res.body.result[0].should.have.property('year'); res.body.result[0].should.have.property('year');
done(); done();
...@@ -587,13 +622,16 @@ describe('request schools count', () => { ...@@ -587,13 +622,16 @@ describe('request schools count', () => {
it('should list school with valid dimensions and filters related to library and reading_room of cities of Paraná', (done) => { it('should list school with valid dimensions and filters related to library and reading_room of cities of Paraná', (done) => {
chai.request(server) chai.request(server)
.get('/api/v1/school/count?dims=state,library,reading_room,library_reading_room&filter=min_year:2015,max_year:2016,state:41') .get('/api/v1/school/count?dims=city,library,reading_room,library_reading_room&filter=min_year:2015,max_year:2016,state:41')
.end((err, res) => { .end((err, res) => {
res.should.have.status(200); res.should.have.status(200);
res.should.be.json; res.should.be.json;
res.body.should.have.property('result'); res.body.should.have.property('result');
res.body.result.should.be.a('array'); res.body.result.should.be.a('array');
res.body.result[0].should.have.property('state_name'); res.body.result[0].should.have.property('city_name');
res.body.result[0].should.have.property('library_name');
res.body.result[0].should.have.property('reading_room_name');
res.body.result[0].should.have.property('library_reading_room_name');
res.body.result[0].should.have.property('total'); res.body.result[0].should.have.property('total');
res.body.result[0].should.have.property('year'); res.body.result[0].should.have.property('year');
done(); 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