update tests
This commit is contained in:
parent
3ff4c3ff2f
commit
5e66d35125
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
node_modules/
|
||||
coverage/
|
||||
public/
|
||||
.yarn/
|
||||
|
3
dist/smartcli.classes.smartcli.d.ts
vendored
3
dist/smartcli.classes.smartcli.d.ts
vendored
@ -1,3 +1,4 @@
|
||||
import * as smartq from 'smartq';
|
||||
import { Subject } from 'rxjs';
|
||||
import { Objectmap } from 'lik';
|
||||
export interface ICommandPromiseObject {
|
||||
@ -11,7 +12,7 @@ export interface ITriggerObservableObject {
|
||||
export declare class Smartcli {
|
||||
argv: any;
|
||||
questionsDone: any;
|
||||
parseStarted: any;
|
||||
parseStarted: smartq.Deferred<any>;
|
||||
commands: any;
|
||||
questions: any;
|
||||
version: string;
|
||||
|
@ -35,7 +35,7 @@
|
||||
"rxjs": "^5.3.0",
|
||||
"smartparam": "0.1.1",
|
||||
"smartq": "^1.1.1",
|
||||
"typings-global": "^1.0.14",
|
||||
"typings-global": "^1.0.16",
|
||||
"yargs": "^7.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
34
test/test.ts
34
test/test.ts
@ -1,4 +1,5 @@
|
||||
import { tap, expect } from 'tapbundle'
|
||||
import { Subject } from 'rxjs'
|
||||
|
||||
import smartcli = require('../dist/index')
|
||||
|
||||
@ -7,20 +8,16 @@ let smartCliTestObject: smartcli.Smartcli
|
||||
tap.test('should create a new Smartcli', async () => {
|
||||
smartCliTestObject = new smartcli.Smartcli()
|
||||
return expect(smartCliTestObject).be.instanceof(smartcli.Smartcli)
|
||||
})
|
||||
|
||||
}).catch(tap.threw)
|
||||
|
||||
tap.test('should add an command', async () => {
|
||||
smartCliTestObject.addCommand('awesome')
|
||||
})
|
||||
return expect(smartCliTestObject.addCommand('awesome')).to.not.throw
|
||||
}).catch(tap.threw)
|
||||
|
||||
|
||||
tap.test('should start parsing a standardTask', async () => {
|
||||
smartCliTestObject.standardTask()
|
||||
.then(() => {
|
||||
console.log('this is the standard Task!')
|
||||
})
|
||||
})
|
||||
return expect(smartCliTestObject.standardTask()).to.be.instanceOf(Promise)
|
||||
}).catch(tap.threw)
|
||||
|
||||
let hasExecuted: boolean = false
|
||||
tap.test('should accept a command', async () => {
|
||||
@ -28,17 +25,20 @@ tap.test('should accept a command', async () => {
|
||||
.subscribe(() => {
|
||||
hasExecuted = true
|
||||
})
|
||||
})
|
||||
|
||||
return expect(smartCliTestObject.addTrigger('triggerme')).to.be.instanceof(Subject)
|
||||
}).catch(tap.threw)
|
||||
|
||||
tap.test('should not have executed yet', async () => {
|
||||
expect(hasExecuted).to.be.false
|
||||
})
|
||||
return expect(hasExecuted).to.be.false
|
||||
}).catch(tap.threw)
|
||||
|
||||
tap.test('should execute when triggered', async () => {
|
||||
smartCliTestObject.trigger('triggerme')
|
||||
expect(hasExecuted).be.true
|
||||
})
|
||||
|
||||
return expect(hasExecuted).be.true
|
||||
}).catch(tap.threw)
|
||||
|
||||
tap.test('should start parsing the CLI input', async () => {
|
||||
smartCliTestObject.startParse()
|
||||
})
|
||||
|
||||
return await expect(smartCliTestObject.parseStarted.promise).to.eventually.be.fulfilled
|
||||
}).catch(tap.threw)
|
||||
|
@ -20,7 +20,7 @@ export interface ITriggerObservableObject {
|
||||
export class Smartcli {
|
||||
argv: any
|
||||
questionsDone
|
||||
parseStarted
|
||||
parseStarted: smartq.Deferred<any>
|
||||
commands
|
||||
questions
|
||||
version: string
|
||||
|
16
yarn.lock
16
yarn.lock
@ -1598,7 +1598,7 @@ set-blocking@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
|
||||
|
||||
shelljs@^0.7.4:
|
||||
shelljs@^0.7.7:
|
||||
version "0.7.7"
|
||||
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1"
|
||||
dependencies:
|
||||
@ -1899,12 +1899,12 @@ typed-promisify@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/typed-promisify/-/typed-promisify-0.3.0.tgz#1ba0af5e444c87d8047406f18ce49092a1191853"
|
||||
|
||||
typings-global@^1.0.14, typings-global@^1.0.3:
|
||||
version "1.0.14"
|
||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.14.tgz#ab682720a03d6b9278869fb5c30c30d7dc61d12c"
|
||||
typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.3:
|
||||
version "1.0.16"
|
||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.16.tgz#489b71781af24268750c2899316400a5e482961f"
|
||||
dependencies:
|
||||
semver "^5.3.0"
|
||||
shelljs "^0.7.4"
|
||||
shelljs "^0.7.7"
|
||||
|
||||
uglify-js@^2.6:
|
||||
version "2.8.22"
|
||||
@ -1961,14 +1961,10 @@ window-size@0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
|
||||
|
||||
wordwrap@0.0.2:
|
||||
wordwrap@0.0.2, wordwrap@~0.0.2:
|
||||
version "0.0.2"
|
||||
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
|
||||
|
||||
wordwrap@~0.0.2:
|
||||
version "0.0.3"
|
||||
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"
|
||||
|
||||
wrap-ansi@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85"
|
||||
|
Loading…
Reference in New Issue
Block a user