@@ -452,7 +452,9 @@ - (void)testQueriesCanUseArrayContainsFilters {
452
452
@" a" : @{@" array" : @[ @42 ]},
453
453
@" b" : @{@" array" : @[ @" a" , @42 , @" c" ]},
454
454
@" c" : @{@" array" : @[ @41.999 , @" 42" , @{@" a" : @[ @42 ]} ]},
455
- @" d" : @{@" array" : @[ @42 ], @" array2" : @[ @" bingo" ]}
455
+ @" d" : @{@" array" : @[ @42 ], @" array2" : @[ @" bingo" ]},
456
+ @" e" : @{@" array" : @[ [NSNull null ] ]},
457
+ @" f" : @{@" array" : @[ @(NAN) ]},
456
458
};
457
459
FIRCollectionReference *collection = [self collectionRefWithDocuments: testDocs];
458
460
@@ -462,8 +464,15 @@ - (void)testQueriesCanUseArrayContainsFilters {
462
464
XCTAssertEqualObjects (FIRQuerySnapshotGetData (snapshot),
463
465
(@[ testDocs[@" a" ], testDocs[@" b" ], testDocs[@" d" ] ]));
464
466
465
- // NOTE: The backend doesn't currently support null, NaN, objects, or arrays, so there isn't much
466
- // of anything else interesting to test.
467
+ // With null.
468
+ snapshot = [self readDocumentSetForRef: [collection queryWhereField: @" array"
469
+ arrayContains: [NSNull null ]]];
470
+ XCTAssertTrue (snapshot.isEmpty );
471
+
472
+ // With NAN.
473
+ snapshot = [self readDocumentSetForRef: [collection queryWhereField: @" array"
474
+ arrayContains: @(NAN)]];
475
+ XCTAssertTrue (snapshot.isEmpty );
467
476
}
468
477
469
478
- (void )testQueriesCanUseInFilters {
@@ -474,7 +483,9 @@ - (void)testQueriesCanUseInFilters {
474
483
@" d" : @{@" zip" : @[ @98101 ]},
475
484
@" e" : @{@" zip" : @[ @" 98101" , @{@" zip" : @98101 } ]},
476
485
@" f" : @{@" zip" : @{@" code" : @500 }},
477
- @" g" : @{@" zip" : @[ @98101 , @98102 ]}
486
+ @" g" : @{@" zip" : @[ @98101 , @98102 ]},
487
+ @" h" : @{@" zip" : [NSNull null ]},
488
+ @" i" : @{@" zip" : @(NAN)}
478
489
};
479
490
FIRCollectionReference *collection = [self collectionRefWithDocuments: testDocs];
480
491
@@ -489,6 +500,24 @@ - (void)testQueriesCanUseInFilters {
489
500
snapshot = [self readDocumentSetForRef: [collection queryWhereField: @" zip"
490
501
in: @[ @{@" code" : @500 } ]]];
491
502
XCTAssertEqualObjects (FIRQuerySnapshotGetData (snapshot), (@[ testDocs[@" f" ] ]));
503
+
504
+ // With null.
505
+ snapshot = [self readDocumentSetForRef: [collection queryWhereField: @" zip" in: @[ [NSNull null ] ]]];
506
+ XCTAssertTrue (snapshot.isEmpty );
507
+
508
+ // With null and a value.
509
+ snapshot = [self readDocumentSetForRef: [collection queryWhereField: @" zip"
510
+ in: @[ [NSNull null ], @98101 ]]];
511
+ XCTAssertEqualObjects (FIRQuerySnapshotGetData (snapshot), (@[ testDocs[@" a" ] ]));
512
+
513
+ // With NAN.
514
+ snapshot = [self readDocumentSetForRef: [collection queryWhereField: @" zip" in: @[ @(NAN) ]]];
515
+ XCTAssertTrue (snapshot.isEmpty );
516
+
517
+ // With NAN and a value.
518
+ snapshot = [self readDocumentSetForRef: [collection queryWhereField: @" zip"
519
+ in: @[ @(NAN), @98101 ]]];
520
+ XCTAssertEqualObjects (FIRQuerySnapshotGetData (snapshot), (@[ testDocs[@" a" ] ]));
492
521
}
493
522
494
523
- (void )testQueriesCanUseInFiltersWithDocIds {
@@ -584,6 +613,9 @@ - (void)testQueriesCanUseArrayContainsAnyFilters {
584
613
@" e" : @{@" array" : @[ @43 ]},
585
614
@" f" : @{@" array" : @[ @{@" a" : @42 } ]},
586
615
@" g" : @{@" array" : @42 },
616
+ @" h" : @{@" array" : @[ [NSNull null ] ]},
617
+ @" g" : @{@" array" : @[ @(NAN) ]},
618
+
587
619
};
588
620
FIRCollectionReference *collection = [self collectionRefWithDocuments: testDocs];
589
621
@@ -599,6 +631,26 @@ - (void)testQueriesCanUseArrayContainsAnyFilters {
599
631
XCTAssertEqualObjects (FIRQuerySnapshotGetData (snapshot), (@[
600
632
testDocs[@" f" ],
601
633
]));
634
+
635
+ // With null.
636
+ snapshot = [self readDocumentSetForRef: [collection queryWhereField: @" array"
637
+ arrayContainsAny: @[ [NSNull null ] ]]];
638
+ XCTAssertTrue (snapshot.isEmpty );
639
+
640
+ // With null and a value.
641
+ snapshot = [self readDocumentSetForRef: [collection queryWhereField: @" array"
642
+ arrayContainsAny: @[ [NSNull null ], @43 ]]];
643
+ XCTAssertEqualObjects (FIRQuerySnapshotGetData (snapshot), (@[ testDocs[@" e" ] ]));
644
+
645
+ // With NAN.
646
+ snapshot = [self readDocumentSetForRef: [collection queryWhereField: @" array"
647
+ arrayContainsAny: @[ @(NAN) ]]];
648
+ XCTAssertTrue (snapshot.isEmpty );
649
+
650
+ // With NAN and a value.
651
+ snapshot = [self readDocumentSetForRef: [collection queryWhereField: @" array"
652
+ arrayContainsAny: @[ @(NAN), @43 ]]];
653
+ XCTAssertEqualObjects (FIRQuerySnapshotGetData (snapshot), (@[ testDocs[@" e" ] ]));
602
654
}
603
655
604
656
- (void )testCollectionGroupQueries {
0 commit comments