nconf-lite/test/stores/memory-test.js
2011-03-31 02:32:47 -04:00

35 lines
No EOL
1 KiB
JavaScript

/*
* memory.js: Simple memory storage engine for nconf configuration(s)
*
* (C) 2011, Charlie Robbins
*
*/
require.paths.unshift(require('path').join(__dirname, '..', '..', 'lib'));
var vows = require('vows'),
assert = require('assert'),
nconf = require('nconf');
vows.describe('nconf/stores/memory').addBatch({
"When using the nconf memory store": {
topic: new nconf.stores.Memory(),
"the set() method": {
"should respond with true": function (store) {
assert.isTrue(store.set('foo:bar:bazz', 'buzz'));
}
},
"the get() method": {
"should respond with the correct value": function (store) {
assert.equal(store.get('foo:bar:bazz'), 'buzz');
}
},
"the clear() method": {
"should respond with the true": function (store) {
assert.equal(store.get('foo:bar:bazz'), 'buzz');
assert.isTrue(store.clear('foo:bar:bazz'));
assert.isTrue(typeof store.get('foo:bar:bazz') === 'undefined');
}
}
}
}).export(module);