2011-03-31 06:32:47 +00:00
|
|
|
/*
|
2011-04-02 08:31:20 +00:00
|
|
|
* memory-store-test.js: Tests for the nconf Memory store.
|
2011-03-31 06:32:47 +00:00
|
|
|
*
|
|
|
|
* (C) 2011, Charlie Robbins
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
var vows = require('vows'),
|
|
|
|
assert = require('assert'),
|
2011-05-14 05:47:26 +00:00
|
|
|
nconf = require('../lib/nconf');
|
2011-03-31 06:32:47 +00:00
|
|
|
|
|
|
|
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);
|