Skip to content

Commit

Permalink
Merge 83b11e8 into b90361b
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbjensen committed May 26, 2015
2 parents b90361b + 83b11e8 commit 942d9d2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"devDependencies": {
"connect-livereload": "0.5.2",
"coveralls": "2.11.2",
"gently": "^0.9.2",
"grunt": "0.4.5",
"grunt-cli": "0.1.13",
"grunt-concurrent": "1.0.0",
Expand Down Expand Up @@ -82,7 +83,8 @@
"test-debug": "node_modules/.bin/mocha --debug-brk test/unit/**/* --reporter spec --require should --require sinon"
},
"pre-commit": [
"lint", "quick-test"
"lint",
"quick-test"
],
"directories": {
"lib": "./lib",
Expand Down
42 changes: 31 additions & 11 deletions test/unit/cli/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@

// Dependencies
//
// var Gently = require('gently');
var assert = require('assert');
var Gently = require('gently');
var generator = require('../../../lib/cli/generate.js');
var index = require('../../../lib/cli/index.js');
var gently = new Gently();



describe('lib/cli/index.js', function () {
describe('/index.js', function () {



Expand All @@ -18,28 +22,44 @@ describe('lib/cli/index.js', function () {

describe('when the 1st argument is n', function () {

it('should call the generator with the program arguments');
// For this, we stub the generator using Gently, and assert
// that it receives the expected arguments from the CLI module
it('should call the generator with the program arguments', function (done) {
var program = {args: ['n', 'testapp']};
gently.expect(generator, 'generate', function (receivedProgram) {
assert.deepEqual(program,receivedProgram);
done();
});
index.process(program);
});

});



describe('when the 1st argument is new', function () {

it('should call the generator with the program arguments');
// For this, we stub the generator using Gently, and assert
// that it receives the expected arguments from the CLI module
it('should call the generator with the program arguments', function (done) {
var program = {args: ['new', 'testapp']};
gently.expect(generator, 'generate', function (receivedProgram) {
assert.deepEqual(program,receivedProgram);
done();
});
index.process(program);
});

});



describe('when the 1st argument is neither "n" or "new"', function () {

it('should inform the user on how to use the application');
// NOTE - how do we capture this use case?
it('should inform the user on how to use the application', function (done) {
var program = {args: ['create', 'testapp']};
gently.expect(console, 'log', function (string) {
assert.deepEqual('Type "socketstream new <projectname>" to create a new application',string);
done();
});
index.process(program);
});

});

Expand All @@ -49,4 +69,4 @@ describe('lib/cli/index.js', function () {



});
});

0 comments on commit 942d9d2

Please sign in to comment.