Skip to content
Snippets Groups Projects
Commit 36e12d51 authored by Vytor Calixto's avatar Vytor Calixto :space_invader:
Browse files

Update tests

parent b85971ad
No related branches found
No related tags found
No related merge requests found
...@@ -161,7 +161,7 @@ distributionApp.get('/', rqf.parse(), (req, res, next) => { ...@@ -161,7 +161,7 @@ distributionApp.get('/', rqf.parse(), (req, res, next) => {
let result = []; let result = [];
let first = true; let first = true;
req.enrollmentFactor.forEach((city) => { req.enrollmentFactor.forEach((city) => {
if(first) console.log(city); // if(first) console.log(city);
let obj = { let obj = {
level: city.nivel, level: city.nivel,
region_id: city.regiao_id, region_id: city.regiao_id,
...@@ -172,7 +172,7 @@ distributionApp.get('/', rqf.parse(), (req, res, next) => { ...@@ -172,7 +172,7 @@ distributionApp.get('/', rqf.parse(), (req, res, next) => {
city_name: city.city_name, city_name: city.city_name,
series: [] series: []
}; };
if(first) console.log(obj); // if(first) console.log(obj);
first = false; first = false;
relation.forEach((serie) => { relation.forEach((serie) => {
obj.series.push({ obj.series.push({
......
...@@ -241,8 +241,8 @@ function matchQueries(queryTotal, queryPartial) { ...@@ -241,8 +241,8 @@ function matchQueries(queryTotal, queryPartial) {
keys.forEach((key) => { keys.forEach((key) => {
newObj[key] = result[key]; newObj[key] = result[key];
}); });
console.log('NEW OBJ'); // console.log('NEW OBJ');
console.log(newObj); // console.log(newObj);
let index = keys.indexOf('total'); let index = keys.indexOf('total');
if(index > -1) keys.splice(index, 1); if(index > -1) keys.splice(index, 1);
let objMatch = null; let objMatch = null;
...@@ -264,7 +264,7 @@ function matchQueries(queryTotal, queryPartial) { ...@@ -264,7 +264,7 @@ function matchQueries(queryTotal, queryPartial) {
} }
if(objMatch) { if(objMatch) {
console.log(objMatch); // console.log(objMatch);
newObj.denominator = result.total; newObj.denominator = result.total;
newObj.partial = objMatch.total; newObj.partial = objMatch.total;
newObj.total = (objMatch.total / result.total) * 100; newObj.total = (objMatch.total / result.total) * 100;
......
...@@ -23,7 +23,7 @@ const libs = `${process.cwd()}/libs`; ...@@ -23,7 +23,7 @@ const libs = `${process.cwd()}/libs`;
const server = require(`${libs}/app`); const server = require(`${libs}/app`);
chai.use(chaiHttp); chai.use(chaiHttp);
describe('request idhme', () => { describe('request infrastructure', () => {
it('should list default query infrastructure', (done) => { it('should list default query infrastructure', (done) => {
chai.request(server) chai.request(server)
.get('/api/v1/infrastructure') .get('/api/v1/infrastructure')
...@@ -63,9 +63,9 @@ describe('request idhme', () => { ...@@ -63,9 +63,9 @@ describe('request idhme', () => {
}); });
}); });
it('should list the locations detailed', (done) => { it('should list the rural locations', (done) => {
chai.request(server) chai.request(server)
.get('/api/v1/infrastructure/location_detailed') .get('/api/v1/infrastructure/rural_location')
.end((err, res) => { .end((err, res) => {
res.should.have.status(200); res.should.have.status(200);
res.should.be.json; res.should.be.json;
......
...@@ -67,21 +67,6 @@ describe('request siope', () => { ...@@ -67,21 +67,6 @@ describe('request siope', () => {
}); });
}); });
it('should list siope with valid filters', (done) => {
chai.request(server)
.get('/api/v1/siope?filter=max_year:2013')
.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('year');
res.body.result[0].should.have.property('state_id');
res.body.result[0].should.have.property('fundeb');
done();
});
});
it('should list siope with valid dimensions', (done) => { it('should list siope with valid dimensions', (done) => {
chai.request(server) chai.request(server)
.get('/api/v1/siope?dims=state') .get('/api/v1/siope?dims=state')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment