diff --git a/lib/nconf/stores/memory.js b/lib/nconf/stores/memory.js index f571759..1d25cd3 100644 --- a/lib/nconf/stores/memory.js +++ b/lib/nconf/stores/memory.js @@ -199,4 +199,12 @@ Memory.prototype.reset = function () { this.mtimes = {}; this.store = {}; return true; +}; + +// +// ### function loadSync +// Returns the store managed by this instance +// +Memory.prototype.loadSync = function () { + return this.store || {}; }; \ No newline at end of file diff --git a/test/nconf-test.js b/test/nconf-test.js index 26d04f0..677b141 100644 --- a/test/nconf-test.js +++ b/test/nconf-test.js @@ -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: {} } }); } } },