diff --git a/test/test.js b/test/test.js index 22bb62399acf6ddca1d4bcf0d21e24faae90bf78..67c3337ece134c4da24791647fce4df4b46452af 100644 --- a/test/test.js +++ b/test/test.js @@ -5,15 +5,9 @@ var expect = chai.expect; var should = chai.should(); //actually call the function var server = require('../libs/app'); -var foo = 'bar'; - - -it('doesn\'t do anything', function(){ - assert.typeOf(foo, 'string', 'foo is a string'); -}); +chai.use(chaiHttp); describe('request enrollments', function(){ - chai.use(chaiHttp); it('should list enrollments', function(done){ chai.request(server) @@ -24,6 +18,39 @@ describe('request enrollments', function(){ 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'); + done(); + }) + }); +}); + +describe('request regions', function(){ + + it('should list all regions', function(done){ + chai.request(server) + .get('/v1/regions') + .end(function(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('pk_regiao_id'); + res.body.result[0].should.have.property('nome'); + done(); + }) + }); + + it('should list a especific region', function(done){ + chai.request(server) + .get('/v1/regions/1') + .end(function(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.should.have.length(1); + res.body.result[0].should.have.property('pk_regiao_id'); + res.body.result[0].should.have.property('nome'); done(); }) });