add tests for the normal configuration of yargs via argv

This commit is contained in:
AdrieanKhisbe 2017-10-28 19:52:52 +02:00 committed by Matt Hamann
parent 802a8d623f
commit fa215a44f1

View file

@ -21,7 +21,6 @@ vows.describe('nconf/stores/argv').addBatch({
"can be created with a custom yargs":{ "can be created with a custom yargs":{
topic: function(){ topic: function(){
var yargsInstance = yargs.alias('v', 'verbose').default('v', 'false'); var yargsInstance = yargs.alias('v', 'verbose').default('v', 'false');
console.log(yargsInstance)
return [yargsInstance, new nconf.Argv(yargsInstance)]; return [yargsInstance, new nconf.Argv(yargsInstance)];
}, },
"and can give access to them": function (argv) { "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('verbose'), 'false');
assert.equal(argv.get('v'), '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); }).export(module);