diff --git a/test.js b/test.js index 81f1af7..ede12e0 100644 --- a/test.js +++ b/test.js @@ -1,6 +1,6 @@ var Mocha = require('mocha'); -var mocha = new Mocha(); +var mocha = new Mocha({ timeout: 5000 }); mocha.reporter('dot').ui('bdd'); files = [ diff --git a/test/project-test.js b/test/project-test.js index 81fd7c6..5926316 100644 --- a/test/project-test.js +++ b/test/project-test.js @@ -5,25 +5,49 @@ var TeamLab = require('../teamlabapi'), describe('project', function() { var api; - - beforeEach(function() { + var project = null; + + beforeEach(function(done) { api = new TeamLab(Config.domain); + api.authenticate( + Config.true_login.username, + Config.true_login.password, + function(err) { + done(err); + }); }); - + describe('#list', function() { it('should return with a list of projects', function(done) { - api.authenticate( - Config.true_login.username, - Config.true_login.password, - function(err) { - should.not.exist(err); - api.project.all(function(err, data) { - should.not.exist(err); - should.exist(data); - assert(typeof data, typeof new Array()); - done(); - }); - }); + api.project.all(function(err, data) { + should.not.exist(err); + should.exist(data); + assert(typeof data, typeof new Array()); + project = data[0]; + done(); + }); + }); + }); + + describe('#get', function() { + it('should return with a specified project', function(done) { + api.project.get(project.id, function(err, data) { + should.not.exist(err); + should.exist(data); + data.id.should.eql(project.id); + done(); + }); + }); + }); + + describe('#self', function() { + it('should return with a list of projects in which the current user participates', function(done) { + api.project.self(function(err, data) { + should.not.exist(err); + should.exist(data); + assert(typeof data, typeof new Array()); + done(); + }); }); }); }); \ No newline at end of file