Skip to content

Instantly share code, notes, and snippets.

@chris-olszewski
Created May 19, 2017 13:53
Show Gist options
  • Save chris-olszewski/712ed0fe6263e54c6a710d5dfea0b788 to your computer and use it in GitHub Desktop.
Save chris-olszewski/712ed0fe6263e54c6a710d5dfea0b788 to your computer and use it in GitHub Desktop.
Command test
import test from 'ava'
import td from '../helpers/testdouble'
import yargs from 'yargs'
const _new = td.replace('../../src/new')
const parser = yargs.command(require('../../src/commands/new')).help()
const projectName = 'my_project'
const roleName = 'shepRole'
const region = 'mordor'
test('Runs as expected', (t) => {
const command = `new ${projectName} --rolename ${roleName} --region ${region}`
parser.parse(command, (err, agv, output) => {
console.log(output, agv)
if (err) t.fail()
td.verify(_new(td.matchers.contains({ path: projectName, rolename: roleName, region })))
t.pass()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment