diff --git a/src/test/schoolCount.js b/src/test/schoolCount.js index b228615bece9b4edb0dae6c2bb213e5e42c6418f..0a94f2d7a9b235cef2d2136f5d52f75ad6cfe12d 100644 --- a/src/test/schoolCount.js +++ b/src/test/schoolCount.js @@ -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) - .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) => { 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('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('year'); 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) - .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) => { 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('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('year'); 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) - .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) => { 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('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('year'); done(); @@ -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) => { 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) => { 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('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('year'); done();