diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
commit | abd94a7f5a50f43c797a11b53549ae48fff667c3 (patch) | |
tree | ab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/nomnom/test/expected.js | |
parent | a0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff) | |
download | wallet-core-abd94a7f5a50f43c797a11b53549ae48fff667c3.tar.xz |
add node_modules to address #4364
Diffstat (limited to 'node_modules/nomnom/test/expected.js')
-rw-r--r-- | node_modules/nomnom/test/expected.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/node_modules/nomnom/test/expected.js b/node_modules/nomnom/test/expected.js new file mode 100644 index 000000000..f52bd57de --- /dev/null +++ b/node_modules/nomnom/test/expected.js @@ -0,0 +1,60 @@ +var nomnom = require("../nomnom"); + +var opts = { + file: { + position: 0, + required: true + } +} + +var parser = nomnom().options(opts); + +exports.testFlag = function(test) { + test.expect(1); + + nomnom().options({ + file: { + position: 0, + } + }) + .printer(function(string) { + test.equal(0, string.indexOf("'--key1' expects a value")) + test.done(); + }) + .parse(["--key1"]); +} + +exports.testRequired = function(test) { + test.expect(1); + + nomnom().options({ + file: { + required: true + } + }) + .printer(function(string) { + test.equal(0, string.trim().indexOf("file argument is required")) + test.done(); + }) + .nocolors() + .parse([]); +} + +exports.testChoices = function(test) { + test.expect(2); + + var parser = nomnom().options({ + color: { + choices: ['green', 'blue'] + } + }) + .printer(function(string) { + test.equal(0, string.indexOf("color must be one of: green, blue")) + }); + + parser.parse(['--color', 'red']); + + var options = parser.parse(['--color', 'green']); + test.equal(options.color, 'green'); + test.done(); +} |