[test] Test for hierarchical argv options get()
This commit is contained in:
parent
c3c315d648
commit
47a56ccb5a
3 changed files with 25 additions and 0 deletions
3
test/fixtures/scripts/hierarchical.json
vendored
Normal file
3
test/fixtures/scripts/hierarchical.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"test": "empty"
|
||||
}
|
17
test/fixtures/scripts/nconf-hierarchical-file-argv.js
vendored
Normal file
17
test/fixtures/scripts/nconf-hierarchical-file-argv.js
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* nconf-hierarchical-file-argv.js: Test fixture for using optimist defaults and a file store with nconf.
|
||||
*
|
||||
* (C) 2011, Charlie Robbins
|
||||
* (C) 2011, Sander Tolsma
|
||||
*
|
||||
*/
|
||||
|
||||
var path = require('path'),
|
||||
nconf = require('../../../lib/nconf');
|
||||
|
||||
nconf.argv();
|
||||
nconf.add('file', {
|
||||
file: path.join(__dirname, 'hierarchical.json')
|
||||
});
|
||||
|
||||
process.stdout.write(nconf.get('something') || 'undefined');
|
|
@ -55,6 +55,11 @@ vows.describe('nconf/provider').addBatch({
|
|||
"when 'argv' is set to true and process.argv is modified": helpers.assertSystemConf({
|
||||
script: path.join(fixturesDir, 'scripts', 'nconf-change-argv.js'),
|
||||
argv: ['--something', 'badValue', 'evenWorse', 'OHNOEZ', 'foobar']
|
||||
}),
|
||||
"when hierarchical 'argv' get": helpers.assertSystemConf({
|
||||
script: path.join(fixturesDir, 'scripts', 'nconf-hierarchical-file-argv.js'),
|
||||
argv: ['--something', 'foobar'],
|
||||
env: { SOMETHING: true }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue