I'm running across this issue with both set and update. If part of the submitted data contains a new node whose value is null, the mock data returned includes that node when it should not. Here's a sample test to demonstrate:
test/unit/firebase.js:
describe('#set', function () {
beforeEach(function () {
ref.autoFlush();
});
it('should not create children which have null values', function() {
var dataToSet = {
a: 'test',
f: null
},
dataToExpect = {
a: 'test'
};
ref.set(dataToSet);
expect(ref.getData()).to.deep.equal(dataToExpect);
});
});
output:
1) MockFirebase #set should not create children which have null values:
AssertionError: expected { a: 'test', f: null } to deeply equal { a: 'test' }
+ expected - actual
{
"a": "test"
- "f": [null]
}
I'm running across this issue with both
set
andupdate
. If part of the submitted data contains a new node whose value isnull
, the mock data returned includes that node when it should not. Here's a sample test to demonstrate:test/unit/firebase.js:
output: