Added test to confirm merging an Object and null behaves as expected.

This commit is contained in:
Michael Schoonmaker 2012-12-20 19:02:36 -08:00
parent ed41c51850
commit 5d2ebfbe9f
3 changed files with 11 additions and 2 deletions

View file

@ -12,5 +12,8 @@
"first": 1, "first": 1,
"second": 2 "second": 2
} }
},
"unicorn": {
"exists": true
} }
} }

View file

@ -5,5 +5,6 @@
"something4": true "something4": true
}, },
"dates": true, "dates": true,
"elderberries": true "elderberries": true,
"unicorn": null
} }

View file

@ -84,6 +84,11 @@ vows.describe('nconf/provider').addBatch({
provider.merge(override); provider.merge(override);
helpers.assertMerged(null, provider.stores.file.store); helpers.assertMerged(null, provider.stores.file.store);
assert.equal(provider.stores.file.store.candy.something, 'file1'); assert.equal(provider.stores.file.store.candy.something, 'file1');
},
"should merge Objects over null": function (provider) {
provider.load();
provider.merge(override);
assert.equal(provider.stores.file.store.unicorn.exists, true);
} }
} }
} }