File tree 1 file changed +9
-0
lines changed 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -454,6 +454,13 @@ describe("DataSnapshot", () => {
454
454
expect ( subject . child ( "a" ) . val ( ) ) . to . deep . equal ( { b : "c" , d : "e" } ) ;
455
455
} ) ;
456
456
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
+
457
464
it ( "should return null for children past a leaf" , ( ) => {
458
465
populate ( applyChange ( { a : 23 } , { b : 33 } ) ) ;
459
466
expect ( subject . child ( "a/b" ) . val ( ) ) . to . be . null ;
@@ -466,6 +473,8 @@ describe("DataSnapshot", () => {
466
473
expect ( subject . val ( ) ) . to . eq ( 23 ) ;
467
474
populate ( { b : 23 , a : null } ) ;
468
475
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 ;
469
478
} ) ;
470
479
471
480
it ( "should coerce object into array if all keys are integers" , ( ) => {
You can’t perform that action at this time.
0 commit comments