-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change argv pipeline to init -> applyConfig -> prepareContext
- Loading branch information
Showing
8 changed files
with
89 additions
and
70 deletions.
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
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
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 was deleted.
Oops, something went wrong.
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,34 @@ | ||
const assert = require('assert'); | ||
const cli = require('../lib'); | ||
|
||
describe('init()/applyConfig()/finishContext()', function() { | ||
let command; | ||
let calls; | ||
|
||
beforeEach(function() { | ||
calls = []; | ||
command = cli.command('test', '[arg1]') | ||
.init(() => calls.push('init')) | ||
.applyConfig(() => calls.push('applyConfig')) | ||
.finishContext(() => calls.push('finishContext')); | ||
command.command('nested', '[arg2] [arg3]') | ||
.init(() => calls.push('nested init')) | ||
.applyConfig(() => calls.push('nested applyConfig')) | ||
.finishContext(() => calls.push('nested finishContext')); | ||
}); | ||
|
||
it('with no arguments should init/finishContext top level command only', function() { | ||
command.run([]); | ||
assert.deepEqual(calls, ['init', 'applyConfig', 'finishContext']); | ||
}); | ||
|
||
it('with one argument should init and finishContext top level command', function() { | ||
command.run(['foo']); | ||
assert.deepEqual(calls, ['init', 'applyConfig', 'finishContext']); | ||
}); | ||
|
||
it('with first argument as command should init/finishContext both commands', function() { | ||
command.run(['nested']); | ||
assert.deepEqual(calls, ['init', 'applyConfig', 'finishContext', 'nested init', 'nested applyConfig', 'nested finishContext']); | ||
}); | ||
}); |
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