[api minor] Add .loadSync()
to Memory store. Fixes #24
This commit is contained in:
parent
d0a91219ec
commit
6242caafda
2 changed files with 14 additions and 4 deletions
|
@ -200,3 +200,11 @@ Memory.prototype.reset = function () {
|
|||
this.store = {};
|
||||
return true;
|
||||
};
|
||||
|
||||
//
|
||||
// ### function loadSync
|
||||
// Returns the store managed by this instance
|
||||
//
|
||||
Memory.prototype.loadSync = function () {
|
||||
return this.store || {};
|
||||
};
|
|
@ -28,6 +28,7 @@ vows.describe('nconf').addBatch({
|
|||
"the use() method": {
|
||||
"should instaniate the correct store": function () {
|
||||
nconf.use('memory');
|
||||
nconf.load();
|
||||
assert.instanceOf(nconf.stores['memory'], nconf.Memory);
|
||||
}
|
||||
},
|
||||
|
@ -79,16 +80,17 @@ vows.describe('nconf').addBatch({
|
|||
},
|
||||
"the load() method": {
|
||||
"without a callback": {
|
||||
"should throw an exception": function () {
|
||||
assert.throws(function () { nconf.load() });
|
||||
"should respond with the merged store": function () {
|
||||
assert.deepEqual(nconf.load(), { foo: { bar: {} } });
|
||||
}
|
||||
},
|
||||
"with a callback": {
|
||||
topic: function () {
|
||||
nconf.load(this.callback.bind(null, null));
|
||||
},
|
||||
"should respond with an error": function (ign, err) {
|
||||
assert.isNotNull(err);
|
||||
"should respond with the merged store": function (ign, err, store) {
|
||||
assert.isNull(err);
|
||||
assert.deepEqual(store, { foo: { bar: {} } });
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue