diff --git a/.gitignore b/.gitignore index 2f61fb3..6e36387 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ pids # Directory for instrumented libs generated by jscoverage/JSCover lib-cov +unit-test-coverage # Coverage directory used by tools like istanbul coverage @@ -29,11 +30,13 @@ build/Release # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git node_modules -# IDE -.settings +#docs +docs -# Mac -.DS_STORE +#idea +.idea -# Test coverage -unit-test-coverage \ No newline at end of file +#Visual Code +.settings +launch.json +.DS_Store \ No newline at end of file diff --git a/test/test-account-manager.js b/test/test-account-manager.js new file mode 100644 index 0000000..03c73f1 --- /dev/null +++ b/test/test-account-manager.js @@ -0,0 +1,66 @@ +'use strict'; +var AccountManagerHelper = require('../app/lib/AccountManagerHelper.js'); +var should = require('chai').should(); +var helper = new AccountManagerHelper('http://localhost:3000/account-manager'); + +describe('AccountManagerHelper', function () { + + describe('createProject()', function () { + it('Should create projects from a user', function (done) { + var promiss = helper.createProject({ + owner: 'email@email.com', + name: 'Project 201', + description: 'Descricao', + }); + promiss + .then( + function (res) { + res[0].should.have.property('project'); + res[0].project.should.have.property('safeName'); + res[0].project.should.have.property('name'); + res[0].project.should.have.property('description'); + res[0].project.should.have.property('code'); + } + ) + .done(function () { + done(); + }); + }); + + it('Should not create projects from a wrong user param', + function (done) { + var promiss = helper.createProject({ + owner: 'email@email.com', + name: 'Project 400', + description: 'Descricao', + }); + promiss + .catch(function (err) { + err.should.not.be.null; + err.should.have.property('code'); + err.should.have.property('message'); + err.code.should.be.equals(400); + }) + .done(function () { + done(); + }); + }); + + it('Should not create projects without info', function (done) { + var promiss = helper.createProject({ + }); + promiss + .catch(function (err) { + err.should.not.be.null; + err.should.have.property('code'); + err.should.have.property('message'); + err.code.should.be.equals(500); + }) + .done(function () { + done(); + }); + }); + }); + + +});