From 697d8ee84ef042165dd1db66a1fb06ad4bfb9b0b Mon Sep 17 00:00:00 2001
From: hi15 <hi15@inf.ufpr.br>
Date: Tue, 9 May 2017 10:05:57 -0300
Subject: [PATCH] Improvment of tests in school routes

---
 src/test/schoolCount.js | 58 ++++++++++++++++++++++++++++++++++-------
 1 file changed, 48 insertions(+), 10 deletions(-)

diff --git a/src/test/schoolCount.js b/src/test/schoolCount.js
index b228615b..0a94f2d7 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();
-- 
GitLab