Skip to content

Commit 3b82456

Browse files
committed
Added test cases for fix
1 parent 18b714b commit 3b82456

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

spec/v1/providers/database.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,13 @@ describe("DataSnapshot", () => {
454454
expect(subject.child("a").val()).to.deep.equal({ b: "c", d: "e" });
455455
});
456456

457+
it("should return null for null data", () => {
458+
populate(null);
459+
expect(subject.val()).to.be.null;
460+
expect(subject.child("a").val()).to.be.null;
461+
expect(subject.child("a/b").val()).to.be.null;
462+
});
463+
457464
it("should return null for children past a leaf", () => {
458465
populate(applyChange({ a: 23 }, { b: 33 }));
459466
expect(subject.child("a/b").val()).to.be.null;
@@ -466,6 +473,8 @@ describe("DataSnapshot", () => {
466473
expect(subject.val()).to.eq(23);
467474
populate({ b: 23, a: null });
468475
expect(subject.child("b").val()).to.eq(23);
476+
expect(subject.child("a").val()).to.be.null;
477+
expect(subject.child("a/c").val()).to.be.null;
469478
});
470479

471480
it("should coerce object into array if all keys are integers", () => {

0 commit comments

Comments
 (0)