Open jampueroc opened 6 years ago
Hi, I found that datasnapshot can be undefined and in your code only checks for nulls, so i added this check.
Here is an example of this bug
describe('Bug', ()=>{ let databaseMock; before(() => { const Mock = require('firemock').Mock; databaseMock = new Mock( { place:{ 'id1':{ id: "-hello" }, 'id2':{ id: "-bye" }, } }); }); after(() => { }); it('should be fail', ()=>{ const path = 'place/id3'; return databaseMock.ref(path).set({id:'bug'}).then(()=>{ return databaseMock.ref(path).remove().then(()=>{ const elementDeleted = databaseMock.ref(path).onceSync("value"); assert.isUndefined(elementDeleted.val()); // this works assert.isFalse(elementDeleted.exists()); // this fail }) }); }) });
thanks!
So sorry, just saw this PR now ... two years later :)
Hi, I found that datasnapshot can be undefined and in your code only checks for nulls, so i added this check.
Here is an example of this bug
thanks!