@@ -24,7 +24,6 @@ import { EventsAccumulator } from '../util/events_accumulator';
24
24
import * as firebaseExport from '../util/firebase_export' ;
25
25
import {
26
26
apiDescribe ,
27
- isRunningAgainstEmulator ,
28
27
notEqualOp ,
29
28
notInOp ,
30
29
toChangesArray ,
@@ -687,101 +686,82 @@ apiDescribe('Queries', (persistence: boolean) => {
687
686
} ) ;
688
687
} ) ;
689
688
690
- // eslint-disable-next-line no-restricted-properties
691
- ( isRunningAgainstEmulator ( ) ? it : it . skip ) (
692
- 'can use != filters' ,
693
- async ( ) => {
694
- const testDocs = {
695
- a : { zip : 98101 } ,
696
- b : { zip : 91102 } ,
697
- c : { zip : '98101' } ,
698
- d : { zip : [ 98101 ] } ,
699
- e : { zip : [ '98101' , { zip : 98101 } ] } ,
700
- f : { zip : { code : 500 } } ,
701
- g : { zip : [ 98101 , 98102 ] } ,
702
- h : { code : 500 } ,
703
- i : { zip : null } ,
704
- j : { zip : Number . NaN }
705
- } ;
689
+ it ( 'can use != filters' , async ( ) => {
690
+ const testDocs = {
691
+ a : { zip : 98101 } ,
692
+ b : { zip : 91102 } ,
693
+ c : { zip : '98101' } ,
694
+ d : { zip : [ 98101 ] } ,
695
+ e : { zip : [ '98101' , { zip : 98101 } ] } ,
696
+ f : { zip : { code : 500 } } ,
697
+ g : { zip : [ 98101 , 98102 ] } ,
698
+ h : { code : 500 } ,
699
+ i : { zip : null } ,
700
+ j : { zip : Number . NaN }
701
+ } ;
706
702
707
- await withTestCollection ( persistence , testDocs , async coll => {
708
- let expected = { ...testDocs } ;
709
- // @ts -expect-error
710
- delete expected . a ;
711
- // @ts -expect-error
712
- delete expected . h ;
713
- // @ts -expect-error
714
- delete expected . i ;
715
- const snapshot = await coll . where ( 'zip' , notEqualOp , 98101 ) . get ( ) ;
716
- expect ( toDataArray ( snapshot ) ) . to . have . deep . members (
717
- Object . values ( expected )
718
- ) ;
703
+ await withTestCollection ( persistence , testDocs , async coll => {
704
+ let expected = { ...testDocs } ;
705
+ delete expected . a ;
706
+ delete expected . h ;
707
+ delete expected . i ;
708
+ const snapshot = await coll . where ( 'zip' , notEqualOp , 98101 ) . get ( ) ;
709
+ expect ( toDataArray ( snapshot ) ) . to . have . deep . members (
710
+ Object . values ( expected )
711
+ ) ;
719
712
720
- // With objects.
721
- const snapshot2 = await coll
722
- . where ( 'zip' , notEqualOp , { code : 500 } )
723
- . get ( ) ;
724
- expected = { ...testDocs } ;
725
- // @ts -expect-error
726
- delete expected . f ;
727
- // @ts -expect-error
728
- delete expected . h ;
729
- // @ts -expect-error
730
- delete expected . i ;
731
- expect ( toDataArray ( snapshot2 ) ) . to . have . deep . members (
732
- Object . values ( expected )
733
- ) ;
713
+ // With objects.
714
+ const snapshot2 = await coll
715
+ . where ( 'zip' , notEqualOp , { code : 500 } )
716
+ . get ( ) ;
717
+ expected = { ...testDocs } ;
718
+ delete expected . f ;
719
+ delete expected . h ;
720
+ delete expected . i ;
721
+ expect ( toDataArray ( snapshot2 ) ) . to . have . deep . members (
722
+ Object . values ( expected )
723
+ ) ;
734
724
735
- // With null.
736
- const snapshot3 = await coll . where ( 'zip' , notEqualOp , null ) . get ( ) ;
737
- expected = { ...testDocs } ;
738
- // @ts -expect-error
739
- delete expected . h ;
740
- // @ts -expect-error
741
- delete expected . i ;
742
- expect ( toDataArray ( snapshot3 ) ) . to . have . deep . members (
743
- Object . values ( expected )
744
- ) ;
725
+ // With null.
726
+ const snapshot3 = await coll . where ( 'zip' , notEqualOp , null ) . get ( ) ;
727
+ expected = { ...testDocs } ;
728
+ delete expected . h ;
729
+ delete expected . i ;
730
+ expect ( toDataArray ( snapshot3 ) ) . to . have . deep . members (
731
+ Object . values ( expected )
732
+ ) ;
745
733
746
- // With NaN.
747
- const snapshot4 = await coll . where ( 'zip' , notEqualOp , Number . NaN ) . get ( ) ;
748
- expected = { ...testDocs } ;
749
- // @ts -expect-error
750
- delete expected . h ;
751
- // @ts -expect-error
752
- delete expected . i ;
753
- // @ts -expect-error
754
- delete expected . j ;
755
- expect ( toDataArray ( snapshot4 ) ) . to . have . deep . members (
756
- Object . values ( expected )
757
- ) ;
758
- } ) ;
759
- }
760
- ) ;
761
-
762
- // eslint-disable-next-line no-restricted-properties
763
- ( isRunningAgainstEmulator ( ) ? it : it . skip ) (
764
- 'can use != filters by document ID' ,
765
- async ( ) => {
766
- const testDocs = {
767
- aa : { key : 'aa' } ,
768
- ab : { key : 'ab' } ,
769
- ba : { key : 'ba' } ,
770
- bb : { key : 'bb' }
771
- } ;
772
- await withTestCollection ( persistence , testDocs , async coll => {
773
- const snapshot = await coll
774
- . where ( FieldPath . documentId ( ) , notEqualOp , 'aa' )
775
- . get ( ) ;
776
-
777
- expect ( toDataArray ( snapshot ) ) . to . deep . equal ( [
778
- { key : 'ab' } ,
779
- { key : 'ba' } ,
780
- { key : 'bb' }
781
- ] ) ;
782
- } ) ;
783
- }
784
- ) ;
734
+ // With NaN.
735
+ const snapshot4 = await coll . where ( 'zip' , notEqualOp , Number . NaN ) . get ( ) ;
736
+ expected = { ...testDocs } ;
737
+ delete expected . h ;
738
+ delete expected . i ;
739
+ delete expected . j ;
740
+ expect ( toDataArray ( snapshot4 ) ) . to . have . deep . members (
741
+ Object . values ( expected )
742
+ ) ;
743
+ } ) ;
744
+ } ) ;
745
+
746
+ it ( 'can use != filters by document ID' , async ( ) => {
747
+ const testDocs = {
748
+ aa : { key : 'aa' } ,
749
+ ab : { key : 'ab' } ,
750
+ ba : { key : 'ba' } ,
751
+ bb : { key : 'bb' }
752
+ } ;
753
+ await withTestCollection ( persistence , testDocs , async coll => {
754
+ const snapshot = await coll
755
+ . where ( FieldPath . documentId ( ) , notEqualOp , 'aa' )
756
+ . get ( ) ;
757
+
758
+ expect ( toDataArray ( snapshot ) ) . to . deep . equal ( [
759
+ { key : 'ab' } ,
760
+ { key : 'ba' } ,
761
+ { key : 'bb' }
762
+ ] ) ;
763
+ } ) ;
764
+ } ) ;
785
765
786
766
it ( 'can use array-contains filters' , async ( ) => {
787
767
const testDocs = {
@@ -851,100 +831,79 @@ apiDescribe('Queries', (persistence: boolean) => {
851
831
} ) ;
852
832
} ) ;
853
833
854
- // eslint-disable-next-line no-restricted-properties
855
- ( isRunningAgainstEmulator ( ) ? it : it . skip ) (
856
- 'can use NOT_IN filters' ,
857
- async ( ) => {
858
- const testDocs = {
859
- a : { zip : 98101 } ,
860
- b : { zip : 91102 } ,
861
- c : { zip : 98103 } ,
862
- d : { zip : [ 98101 ] } ,
863
- e : { zip : [ '98101' , { zip : 98101 } ] } ,
864
- f : { zip : { code : 500 } } ,
865
- g : { zip : [ 98101 , 98102 ] } ,
866
- h : { code : 500 } ,
867
- i : { zip : null } ,
868
- j : { zip : Number . NaN }
869
- } ;
834
+ it ( 'can use NOT_IN filters' , async ( ) => {
835
+ const testDocs = {
836
+ a : { zip : 98101 } ,
837
+ b : { zip : 91102 } ,
838
+ c : { zip : 98103 } ,
839
+ d : { zip : [ 98101 ] } ,
840
+ e : { zip : [ '98101' , { zip : 98101 } ] } ,
841
+ f : { zip : { code : 500 } } ,
842
+ g : { zip : [ 98101 , 98102 ] } ,
843
+ h : { code : 500 } ,
844
+ i : { zip : null } ,
845
+ j : { zip : Number . NaN }
846
+ } ;
870
847
871
- await withTestCollection ( persistence , testDocs , async coll => {
872
- let expected = { ...testDocs } ;
873
- // @ts -expect-error
874
- delete expected . a ;
875
- // @ts -expect-error
876
- delete expected . c ;
877
- // @ts -expect-error
878
- delete expected . g ;
879
- // @ts -expect-error
880
- delete expected . h ;
881
- const snapshot = await coll
882
- . where ( 'zip' , notInOp , [ 98101 , 98103 , [ 98101 , 98102 ] ] )
883
- . get ( ) ;
884
- expect ( toDataArray ( snapshot ) ) . to . deep . equal ( Object . values ( expected ) ) ;
885
-
886
- // With objects.
887
- const snapshot2 = await coll
888
- . where ( 'zip' , notInOp , [ { code : 500 } ] )
889
- . get ( ) ;
890
- expected = { ...testDocs } ;
891
- // @ts -expect-error
892
- delete expected . f ;
893
- // @ts -expect-error
894
- delete expected . h ;
895
- expect ( toDataArray ( snapshot2 ) ) . to . deep . equal ( Object . values ( expected ) ) ;
896
-
897
- // With null.
898
- const snapshot3 = await coll . where ( 'zip' , notInOp , [ null ] ) . get ( ) ;
899
- expect ( toDataArray ( snapshot3 ) ) . to . deep . equal ( [ ] ) ;
900
-
901
- // With NaN.
902
- const snapshot4 = await coll . where ( 'zip' , notInOp , [ Number . NaN ] ) . get ( ) ;
903
- expected = { ...testDocs } ;
904
- // @ts -expect-error
905
- delete expected . h ;
906
- // @ts -expect-error
907
- delete expected . j ;
908
- expect ( toDataArray ( snapshot4 ) ) . to . deep . equal ( Object . values ( expected ) ) ;
909
-
910
- // With NaN and a number.
911
- const snapshot5 = await coll
912
- . where ( 'zip' , notInOp , [ Number . NaN , 98101 ] )
913
- . get ( ) ;
914
- expected = { ...testDocs } ;
915
- // @ts -expect-error
916
- delete expected . a ;
917
- // @ts -expect-error
918
- delete expected . h ;
919
- // @ts -expect-error
920
- delete expected . j ;
921
- expect ( toDataArray ( snapshot5 ) ) . to . deep . equal ( Object . values ( expected ) ) ;
922
- } ) ;
923
- }
924
- ) ;
925
-
926
- // eslint-disable-next-line no-restricted-properties
927
- ( isRunningAgainstEmulator ( ) ? it : it . skip ) (
928
- 'can use NOT_IN filters by document ID' ,
929
- async ( ) => {
930
- const testDocs = {
931
- aa : { key : 'aa' } ,
932
- ab : { key : 'ab' } ,
933
- ba : { key : 'ba' } ,
934
- bb : { key : 'bb' }
935
- } ;
936
- await withTestCollection ( persistence , testDocs , async coll => {
937
- const snapshot = await coll
938
- . where ( FieldPath . documentId ( ) , notInOp , [ 'aa' , 'ab' ] )
939
- . get ( ) ;
940
-
941
- expect ( toDataArray ( snapshot ) ) . to . deep . equal ( [
942
- { key : 'ba' } ,
943
- { key : 'bb' }
944
- ] ) ;
945
- } ) ;
946
- }
947
- ) ;
848
+ await withTestCollection ( persistence , testDocs , async coll => {
849
+ let expected = { ...testDocs } ;
850
+ delete expected . a ;
851
+ delete expected . c ;
852
+ delete expected . g ;
853
+ delete expected . h ;
854
+ const snapshot = await coll
855
+ . where ( 'zip' , notInOp , [ 98101 , 98103 , [ 98101 , 98102 ] ] )
856
+ . get ( ) ;
857
+ expect ( toDataArray ( snapshot ) ) . to . deep . equal ( Object . values ( expected ) ) ;
858
+
859
+ // With objects.
860
+ const snapshot2 = await coll . where ( 'zip' , notInOp , [ { code : 500 } ] ) . get ( ) ;
861
+ expected = { ...testDocs } ;
862
+ delete expected . f ;
863
+ delete expected . h ;
864
+ expect ( toDataArray ( snapshot2 ) ) . to . deep . equal ( Object . values ( expected ) ) ;
865
+
866
+ // With null.
867
+ const snapshot3 = await coll . where ( 'zip' , notInOp , [ null ] ) . get ( ) ;
868
+ expect ( toDataArray ( snapshot3 ) ) . to . deep . equal ( [ ] ) ;
869
+
870
+ // With NaN.
871
+ const snapshot4 = await coll . where ( 'zip' , notInOp , [ Number . NaN ] ) . get ( ) ;
872
+ expected = { ...testDocs } ;
873
+ delete expected . h ;
874
+ delete expected . j ;
875
+ expect ( toDataArray ( snapshot4 ) ) . to . deep . equal ( Object . values ( expected ) ) ;
876
+
877
+ // With NaN and a number.
878
+ const snapshot5 = await coll
879
+ . where ( 'zip' , notInOp , [ Number . NaN , 98101 ] )
880
+ . get ( ) ;
881
+ expected = { ...testDocs } ;
882
+ delete expected . a ;
883
+ delete expected . h ;
884
+ delete expected . j ;
885
+ expect ( toDataArray ( snapshot5 ) ) . to . deep . equal ( Object . values ( expected ) ) ;
886
+ } ) ;
887
+ } ) ;
888
+
889
+ it ( 'can use NOT_IN filters by document ID' , async ( ) => {
890
+ const testDocs = {
891
+ aa : { key : 'aa' } ,
892
+ ab : { key : 'ab' } ,
893
+ ba : { key : 'ba' } ,
894
+ bb : { key : 'bb' }
895
+ } ;
896
+ await withTestCollection ( persistence , testDocs , async coll => {
897
+ const snapshot = await coll
898
+ . where ( FieldPath . documentId ( ) , notInOp , [ 'aa' , 'ab' ] )
899
+ . get ( ) ;
900
+
901
+ expect ( toDataArray ( snapshot ) ) . to . deep . equal ( [
902
+ { key : 'ba' } ,
903
+ { key : 'bb' }
904
+ ] ) ;
905
+ } ) ;
906
+ } ) ;
948
907
949
908
it ( 'can use array-contains-any filters' , async ( ) => {
950
909
const testDocs = {
0 commit comments