Skip to content

Commit

Permalink
[test] Test for hierarchical argv options get()
Browse files Browse the repository at this point in the history
  • Loading branch information
stolsma authored and indexzero committed Nov 24, 2011
1 parent c3c315d commit 47a56cc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/fixtures/scripts/hierarchical.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"test": "empty"
}
17 changes: 17 additions & 0 deletions test/fixtures/scripts/nconf-hierarchical-file-argv.js
Original file line number Diff line number Diff line change
@@ -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');
5 changes: 5 additions & 0 deletions test/provider-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
})
}
}
Expand Down

0 comments on commit 47a56cc

Please sign in to comment.