diff --git a/package.json b/package.json index 65c122ce23b24c0407badf3a9e1cdf71630d365d..fd0765bb333bc1fa382aae1e82ecb4f500774df4 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "debug": "~2.0.x", "express": "^4.13.0", "faker": "^2.1.5", + "forever": "^0.15.2", "js2xmlparser": "^1.0.0", "method-override": "^2.3.3", "monetdb": "^1.1.2", @@ -25,6 +26,7 @@ "license": "MIT", "devDependencies": { "chai": "^3.5.0", + "chai-http": "^3.0.0", "mocha": "^2.5.3" } } diff --git a/test/test.js b/test/test.js index f05951f4a920193b51a817459bbd69da678a3015..22bb62399acf6ddca1d4bcf0d21e24faae90bf78 100644 --- a/test/test.js +++ b/test/test.js @@ -1,9 +1,30 @@ -var assert = require('chai').assert; -var expect = require('chai').expect; -var should = require('chai').should() //actually call the function +var chai = require('chai'); +var chaiHttp = require('chai-http'); +var assert = chai.assert; +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'); }); + +describe('request enrollments', function(){ + chai.use(chaiHttp); + + it('should list enrollments', function(done){ + chai.request(server) + .get('/v1/enrollments') + .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('name'); + done(); + }) + }); +});