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

Create tests of school routes

parent 02314ce2
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!47School number count
Pipeline #
...@@ -38,6 +38,7 @@ const ids = { ...@@ -38,6 +38,7 @@ const ids = {
restroom_pne_id: booleanVariable, restroom_pne_id: booleanVariable,
broadband_id: booleanVariable, broadband_id: booleanVariable,
energy_id: booleanVariable, energy_id: booleanVariable,
water_id: booleanVariable,
wastepipe_id: booleanVariable, wastepipe_id: booleanVariable,
education_day_care_child_id: booleanVariable, education_day_care_child_id: booleanVariable,
education_preschool_child_id: booleanVariable, education_preschool_child_id: booleanVariable,
......
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('request schools count', () => {
it('should list the locations', (done) => {
chai.request(server)
.get('/api/v1/school/location')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the administrative dependencies', (done) => {
chai.request(server)
.get('/api/v1/school/adm_dependency')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the administrative dependencies detailed', (done) => {
chai.request(server)
.get('/api/v1/school/adm_dependency_detailed')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the government agreement', (done) => {
chai.request(server)
.get('/api/v1/school/government_agreement')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the agreement', (done) => {
chai.request(server)
.get('/api/v1/school/agreement')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the building school', (done) => {
chai.request(server)
.get('/api/v1/school/building_school')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the informatics labs', (done) => {
chai.request(server)
.get('/api/v1/school/informatics_lab')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the science labs', (done) => {
chai.request(server)
.get('/api/v1/school/science_lab')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the directors room', (done) => {
chai.request(server)
.get('/api/v1/school/directors_room')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the teacher room', (done) => {
chai.request(server)
.get('/api/v1/school/teacher_room')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the cook room', (done) => {
chai.request(server)
.get('/api/v1/school/cook_room')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the playgrounds', (done) => {
chai.request(server)
.get('/api/v1/school/playground')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the indor sports court', (done) => {
chai.request(server)
.get('/api/v1/school/indor_sports_court')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the nusery', (done) => {
chai.request(server)
.get('/api/v1/school/nusery')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the special attendence room', (done) => {
chai.request(server)
.get('/api/v1/school/special_attendence_room')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the toilets inside building', (done) => {
chai.request(server)
.get('/api/v1/school/toilet_inside_building')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the denpendency pne', (done) => {
chai.request(server)
.get('/api/v1/school/denpendency_pne')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the restroom pne', (done) => {
chai.request(server)
.get('/api/v1/school/restroom_pne')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the broadband', (done) => {
chai.request(server)
.get('/api/v1/school/broadband')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the energy', (done) => {
chai.request(server)
.get('/api/v1/school/energy')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the water', (done) => {
chai.request(server)
.get('/api/v1/school/water')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the wastepipe', (done) => {
chai.request(server)
.get('/api/v1/school/wastepipe')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the education day care child', (done) => {
chai.request(server)
.get('/api/v1/school/education_day_care_child')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the education preschool child', (done) => {
chai.request(server)
.get('/api/v1/school/education_preschool_child')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the education begin elementary school', (done) => {
chai.request(server)
.get('/api/v1/school/education_begin_elementary_school')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the education begin elementary school', (done) => {
chai.request(server)
.get('/api/v1/school/education_begin_elementary_school')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the education end elementary school', (done) => {
chai.request(server)
.get('/api/v1/school/education_end_elementary_school')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the education middle school', (done) => {
chai.request(server)
.get('/api/v1/school/education_middle_school')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the education professional', (done) => {
chai.request(server)
.get('/api/v1/school/education_professional')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the education eja', (done) => {
chai.request(server)
.get('/api/v1/school/education_eja')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the reading room', (done) => {
chai.request(server)
.get('/api/v1/school/reading_room')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list the library and/or reading_room', (done) => {
chai.request(server)
.get('/api/v1/school/library_reading_room')
.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('id');
res.body.result[0].should.have.property('name');
done();
});
});
it('should list school with valid dimensions and filters', (done) => {
chai.request(server)
.get('/api/v1/school/count?dims=location,adm_dependency,government_agreement,library,reading_room,library_reading_room')
.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('location_name');
res.body.result[0].should.have.property('adm_dependency_name');
res.body.result[0].should.have.property('government_agreement_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();
});
});
it('should list school with valid dimensions and filters', (done) => {
chai.request(server)
.get('/api/v1/school/count?dims=region,state,cook_room&filter=min_year:2015,max_year:2016,city:4106902,indor_sports_court: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('region_name');
res.body.result[0].should.have.property('state_name');
res.body.result[0].should.have.property('cook_room_name');
res.body.result[0].should.have.property('total');
res.body.result[0].should.have.property('year');
done();
});
});
it('should list school with no argument dimensions and filters', (done) => {
chai.request(server)
.get('/api/v1/school/count')
.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('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', (done) => {
chai.request(server)
.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('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('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) => {
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')
.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('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) => {
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')
.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('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) => {
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')
.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();
});
});
});
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