-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d380a22
commit 96e3811
Showing
5 changed files
with
81 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,3 +159,30 @@ test('Ordered Named Arguments', t => { | |
|
||
shell.exec('account create [email protected] pwd') | ||
}) | ||
|
||
|
||
test('Application reference data', async t => { | ||
const data = { test: true } | ||
const sh = new Shell({ | ||
name: 'test', | ||
commands: [{ | ||
name: 'run', | ||
async handler (meta) { | ||
return meta.reference.test | ||
} | ||
}] | ||
}) | ||
|
||
const result = await sh.exec('run', { reference: data }) | ||
|
||
t.expect(result, true, 'reference data detected in handler') | ||
|
||
try { | ||
await sh.exec('run', { demo: data }) | ||
t.fail('failure to provide reference and callback throws error') | ||
} catch (e) { | ||
t.pass('failure to provide reference and callback throws error') | ||
} | ||
|
||
t.end() | ||
}) |