Skip to content

Commit 5416192

Browse files
authored
Fix bug that caused database parent key and child key to be concatenated (#40)
1 parent 9a83599 commit 5416192

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

spec/providers/database.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,15 @@ describe('DeltaSnapshot', () => {
218218
expect(out).to.equal('bd');
219219
});
220220

221+
it('should have correct key values for child snapshots', () => {
222+
populate({ a: 'b' }, { c: 'd' });
223+
let out = '';
224+
subject.forEach(snap => {
225+
out += snap.key;
226+
});
227+
expect(out).to.equal('ac');
228+
});
229+
221230
it('should not execute for leaf or null nodes', () => {
222231
populate(null, 23);
223232
let count = 0;

src/providers/database.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,7 @@ export class DeltaSnapshot implements firebase.database.DataSnapshot {
288288
}
289289

290290
private _fullPath(): string {
291-
let out = (this._path || '') + (this._childPath || '');
292-
if (out === '') {
293-
out = '/';
294-
}
291+
let out = (this._path || '') + '/' + (this._childPath || '');
295292
return out;
296293
}
297294
}

0 commit comments

Comments
 (0)