-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test] Added tests (which are now passing) for #15
- Loading branch information
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"title": "My generic title", | ||
"color": "red", | ||
"movie": "Kill Bill" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"title": "My specific title", | ||
"color": "green" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* hierarchy-test.js: Basic tests for hierarchical file stores. | ||
* | ||
* (C) 2011, Charlie Robbins | ||
* | ||
*/ | ||
|
||
var assert = require('assert'), | ||
path = require('path'), | ||
vows = require('vows'), | ||
nconf = require('../lib/nconf'); | ||
|
||
var configDir = path.join(__dirname, 'fixtures', 'hierarchy'), | ||
globalConfig = path.join(configDir, 'global.json'), | ||
userConfig = path.join(configDir, 'user.json'); | ||
|
||
vows.describe('nconf/hierarchy').addBatch({ | ||
"When using nconf": { | ||
"configured with two file stores": { | ||
topic: function () { | ||
nconf.add('user', { type: 'file', file: userConfig }) | ||
nconf.add('global', { type: 'file', file: globalConfig }) | ||
nconf.load(); | ||
return nconf; | ||
}, | ||
"should have the appropriate keys present": function () { | ||
assert.equal(nconf.get('title'), 'My specific title'); | ||
assert.equal(nconf.get('color'), 'green'); | ||
assert.equal(nconf.get('movie'), 'Kill Bill'); | ||
} | ||
} | ||
} | ||
}).export(module); |