Skip to content
Snippets Groups Projects
Commit d4d8bea5 authored by Fernando Erd's avatar Fernando Erd :ok_hand:
Browse files

Add some tests

parent da464a64
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!87Add some tests
Pipeline #
...@@ -51,6 +51,19 @@ describe('request enrollments', () => { ...@@ -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) => { it('should list the locations', (done) => {
chai.request(server) chai.request(server)
.get('/api/v1/enrollment/location') .get('/api/v1/enrollment/location')
......
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();
});
});
});
...@@ -65,6 +65,19 @@ describe('request teachers', () => { ...@@ -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) => { it('should list the rural locations', (done) => {
chai.request(server) chai.request(server)
.get('/api/v1/teacher/rural_location') .get('/api/v1/teacher/rural_location')
......
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