Feature: List projects
As a vision user I want to see a list of projects So that I can select a project I want to monitor
Let's add a test to ./test/project.js
for our feature List projects
. This resource will GET all projects from route /project
and return a 200 Ok
status.
describe('when requesting resource get all projects', function(){ it('should respond with 200', function(done){ request(app) .get('/project/?user=' + login.user) .expect('Content-Type', /json/) .expect(200) .end(function (err, res) { var proj = _.first(JSON.parse(res.text)) assert(_.has(proj, '_id')); assert(_.has(proj, 'name')); assert(_.has(proj, 'user')); assert(_.has(proj, 'token')); assert(_.has(proj, 'created')); assert(_.has(proj, 'repositories')); done(); }); }); });
Let's implement the List projects
feature ./lib/project/index.js
and add an all
function. We attempt to retrieve all projects by calling the static function Project.find
and...