diff --git a/src/test/enrollment.js b/src/test/enrollment.js index 2d35c63a61b94addd16adf3764fa9330b39fd9a7..1ca9fac5b4fbbbd0a9e28712add470014b9f025d 100644 --- a/src/test/enrollment.js +++ b/src/test/enrollment.js @@ -51,6 +51,19 @@ describe('request enrollments', () => { }); }); + it('should list the years', (done) => { + chai.request(server) + .get('/api/v1/enrollment/years') + .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('years'); + done(); + }); + }); + it('should list the locations', (done) => { chai.request(server) .get('/api/v1/enrollment/location') diff --git a/src/test/infrastructure.js b/src/test/infrastructure.js new file mode 100644 index 0000000000000000000000000000000000000000..43b4a7c950c63014877fb0556bbfc31036f88c57 --- /dev/null +++ b/src/test/infrastructure.js @@ -0,0 +1,122 @@ +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 idhme', () => { + it('should list default query infrastructure', (done) => { + chai.request(server) + .get('/api/v1/infrastructure') + .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('school_place'); + done(); + }); + }); + + it('should list the year range', (done) => { + chai.request(server) + .get('/api/v1/infrastructure/years') + .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('years'); + done(); + }); + }); + + it('should list the source', (done) => { + chai.request(server) + .get('/api/v1/infrastructure/source') + .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('source'); + done(); + }); + }); + + it('should list the locations detailed', (done) => { + chai.request(server) + .get('/api/v1/infrastructure/location_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 locations', (done) => { + chai.request(server) + .get('/api/v1/infrastructure/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 source', (done) => { + chai.request(server) + .get('/api/v1/infrastructure/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 source', (done) => { + chai.request(server) + .get('/api/v1/infrastructure/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(); + }); + }); + +}); diff --git a/src/test/teacher.js b/src/test/teacher.js index 77cc39da9a236e0389508291a65a1108f9517a07..23d9eca667218fdaaf86bc333af8dff31bd2deda 100644 --- a/src/test/teacher.js +++ b/src/test/teacher.js @@ -65,6 +65,19 @@ describe('request teachers', () => { }); }); + it('should list the locations', (done) => { + chai.request(server) + .get('/api/v1/teacher/years') + .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('years'); + done(); + }); + }); + it('should list the rural locations', (done) => { chai.request(server) .get('/api/v1/teacher/rural_location')