Added test to confirm merging an Object and null behaves as expected.
This commit is contained in:
parent
ed41c51850
commit
5d2ebfbe9f
3 changed files with 11 additions and 2 deletions
3
test/fixtures/merge/file1.json
vendored
3
test/fixtures/merge/file1.json
vendored
|
@ -12,5 +12,8 @@
|
||||||
"first": 1,
|
"first": 1,
|
||||||
"second": 2
|
"second": 2
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"unicorn": {
|
||||||
|
"exists": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
3
test/fixtures/merge/file2.json
vendored
3
test/fixtures/merge/file2.json
vendored
|
@ -5,5 +5,6 @@
|
||||||
"something4": true
|
"something4": true
|
||||||
},
|
},
|
||||||
"dates": true,
|
"dates": true,
|
||||||
"elderberries": true
|
"elderberries": true,
|
||||||
|
"unicorn": null
|
||||||
}
|
}
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue