Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from sintaxi/ko-cli-deps-tests
Adds basic tests for actions with Minimist, Yargs, Commander
- Loading branch information
Showing
2 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
var should = require('should') | ||
var minimist = require('minimist')(process.argv.slice(2)) | ||
var yargs = require('yargs') | ||
var commander = require('commander') | ||
var Surge = require('../') | ||
var surge = new Surge | ||
var pkg = require('../package.json') | ||
var hooks = {} | ||
|
||
describe('actions', function (done) { | ||
|
||
describe('login', function (done) { | ||
|
||
it('action', function (done) { | ||
should(surge.login(hooks)).type('function') | ||
done() | ||
}) | ||
|
||
it('commander', function (done) { | ||
var program = commander | ||
program | ||
.command('login') | ||
.action(surge.login(hooks)) | ||
should(program.commands.length).equal(1) | ||
done() | ||
}) | ||
|
||
it('minimist', function (done) { | ||
var program = minimist | ||
should(program._.length).equal(1) | ||
done() | ||
}) | ||
|
||
it('yargs', function (done) { | ||
var program = yargs | ||
program | ||
.command('teardown', 'Login to Surge.', surge.login(hooks)) | ||
.argv | ||
should(program.argv._.length).equal(1) | ||
done() | ||
}) | ||
}) | ||
|
||
// publish | ||
// teardown | ||
// whoami | ||
// list | ||
// plus | ||
// logout | ||
|
||
}) |