Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit 159b011

Browse files
authored
Merge pull request soumak77#112 from bookcreator/slashes2
Fix for soumak77#97
2 parents e2092db + aa4bfd9 commit 159b011

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/firebase.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ MockFirebase.prototype.toString = function () {
146146
};
147147

148148
MockFirebase.prototype.child = function (childPath) {
149+
if (childPath === '/') return this;
149150
assert(childPath, 'A child path is required');
150151
var parts = _.compact(childPath.split('/'));
151152
var childKey = parts.shift();

test/unit/firebase.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@ describe('MockFirebase', function () {
319319
expect(ref.ref).to.equal(ref);
320320
});
321321

322+
it('child / returns same reference', function () {
323+
expect(ref.child('/')).to.equal(ref);
324+
});
325+
322326
});
323327

324328
describe('#set', function () {

0 commit comments

Comments
 (0)