diff --git a/spec/providers/database.spec.ts b/spec/providers/database.spec.ts index db2d5f1ee..89265b167 100644 --- a/spec/providers/database.spec.ts +++ b/spec/providers/database.spec.ts @@ -218,6 +218,15 @@ describe('DeltaSnapshot', () => { expect(out).to.equal('bd'); }); + it('should have correct key values for child snapshots', () => { + populate({ a: 'b' }, { c: 'd' }); + let out = ''; + subject.forEach(snap => { + out += snap.key; + }); + expect(out).to.equal('ac'); + }); + it('should not execute for leaf or null nodes', () => { populate(null, 23); let count = 0; diff --git a/src/providers/database.ts b/src/providers/database.ts index 7e40b8ba4..99de9a94b 100644 --- a/src/providers/database.ts +++ b/src/providers/database.ts @@ -288,10 +288,7 @@ export class DeltaSnapshot implements firebase.database.DataSnapshot { } private _fullPath(): string { - let out = (this._path || '') + (this._childPath || ''); - if (out === '') { - out = '/'; - } + let out = (this._path || '') + '/' + (this._childPath || ''); return out; } }