Skip to content

Commit

Permalink
Merge pull request #161 from sintaxi/ko-cli-deps-tests
Browse files Browse the repository at this point in the history
Adds basic tests for actions with Minimist, Yargs, Commander
  • Loading branch information
sintaxi committed Jan 3, 2016
2 parents 8d9e308 + 277b148 commit 2af0821
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -22,9 +22,11 @@
"minimist": "1.1.1"
},
"devDependencies": {
"commander": "2.9.0",
"mocha": "*",
"nixt": "0.4.1",
"should": "7.1.0"
"should": "7.1.0",
"yargs": "3.30.0"
},
"license": "ISC",
"main": "./lib/surge.js",
Expand Down
51 changes: 51 additions & 0 deletions test/actions.js
@@ -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

})

0 comments on commit 2af0821

Please sign in to comment.