test retrieving non-existent keys and drilling into non-objects

This commit is contained in:
Sami Samhuri 2011-05-22 13:01:49 -07:00
parent 6acc1fc533
commit 8a79ef04fd

View file

@ -28,6 +28,16 @@ vows.describe('nconf/stores/memory').addBatch({
assert.equal(store.get('falsy:string'), ''); assert.equal(store.get('falsy:string'), '');
assert.equal(store.get('falsy:boolean'), false); assert.equal(store.get('falsy:boolean'), false);
assert.equal(store.get('falsy:object'), null); assert.equal(store.get('falsy:object'), null);
},
"should not fail when retrieving non-existent keys": function (store) {
assert.doesNotThrow(function() {
assert.equal(store.get('this:key:does:not:exist'), undefined);
}, TypeError);
},
"should not fail when drilling into non-objects": function (store) {
assert.doesNotThrow(function() {
assert.equal(store.get('falsy:number:uh:oh'), undefined);
}, TypeError);
} }
}, },
"the clear() method": { "the clear() method": {