From 91664cb9ca5f606c8923db737ffe17cd0c106e88 Mon Sep 17 00:00:00 2001 From: Lauren Long Date: Tue, 25 Apr 2017 16:17:55 -0700 Subject: [PATCH 1/2] Fix bug that caused database key and child key to be concatenated --- src/providers/database.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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; } } From f5bb2e88cc890cc9989d7b31985eec56e873b8b2 Mon Sep 17 00:00:00 2001 From: Lauren Long Date: Thu, 27 Apr 2017 14:15:34 -0700 Subject: [PATCH 2/2] Add unit test. --- spec/providers/database.spec.ts | 9 +++++++++ 1 file changed, 9 insertions(+) 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;