Skip to content

Commit

Permalink
[test] Added tests (which are now passing) for #15
Browse files Browse the repository at this point in the history
  • Loading branch information
indexzero committed Nov 24, 2011
1 parent 16a18bf commit 0fbc9a2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/fixtures/hierarchy/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"title": "My generic title",
"color": "red",
"movie": "Kill Bill"
}
4 changes: 4 additions & 0 deletions test/fixtures/hierarchy/user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"title": "My specific title",
"color": "green"
}
33 changes: 33 additions & 0 deletions test/hierarchy-test.js
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);

0 comments on commit 0fbc9a2

Please sign in to comment.