add tests for the normal configuration of yargs via argv

master
AdrieanKhisbe 2017-10-28 19:52:52 +02:00 committed by Matt Hamann
parent 802a8d623f
commit fa215a44f1
1 changed files with 14 additions and 1 deletions

View File

@ -21,7 +21,6 @@ vows.describe('nconf/stores/argv').addBatch({
"can be created with a custom yargs":{
topic: function(){
var yargsInstance = yargs.alias('v', 'verbose').default('v', 'false');
console.log(yargsInstance)
return [yargsInstance, new nconf.Argv(yargsInstance)];
},
"and can give access to them": function (argv) {
@ -35,6 +34,20 @@ vows.describe('nconf/stores/argv').addBatch({
assert.equal(argv.get('verbose'), 'false');
assert.equal(argv.get('v'), 'false');
}
},
"can be created with a nconf yargs":{
topic: function(){
var options = {verbose: {alias: 'v', default: 'false'}};
return new nconf.Argv(options);
},
"and can give access to them": function (argv) {
assert.deepEqual(argv.options, {verbose: {alias: 'v', default: 'false'}})
},
"values are the one from the custom yargv": function (argv) {
argv.loadSync()
assert.equal(argv.get('verbose'), 'false');
assert.equal(argv.get('v'), 'false');
}
}
}
}).export(module);