@@ -961,106 +961,123 @@ apiDescribe('Validation:', (persistence: boolean) => {
961
961
) ;
962
962
} ) ;
963
963
964
- validationIt ( persistence , 'with multiple disjunctive filters fail' , db => {
965
- expect ( ( ) =>
966
- query (
967
- collection ( db , 'test' ) ,
968
- where ( 'foo' , 'not-in' , [ 1 , 2 ] ) ,
969
- where ( 'foo' , 'not-in' , [ 2 , 3 ] )
970
- )
971
- ) . to . throw (
972
- "Invalid query. You cannot use more than one 'not-in' filter."
973
- ) ;
964
+ validationIt . only (
965
+ persistence ,
966
+ 'with multiple disjunctive filters fail' ,
967
+ db => {
968
+ expect ( ( ) =>
969
+ query (
970
+ collection ( db , 'test' ) ,
971
+ where ( 'foo' , 'not-in' , [ 1 , 2 ] ) ,
972
+ where ( 'foo' , 'not-in' , [ 2 , 3 ] )
973
+ )
974
+ ) . to . throw (
975
+ "Invalid query. You cannot use more than one 'not-in' filter."
976
+ ) ;
974
977
975
- expect ( ( ) =>
976
- query (
977
- collection ( db , 'test' ) ,
978
- where ( 'foo' , 'array-contains-any' , [ 1 , 2 ] ) ,
979
- where ( 'foo' , 'array-contains-any' , [ 2 , 3 ] )
980
- )
981
- ) . to . throw (
982
- "Invalid query. You cannot use more than one 'array-contains-any'" +
983
- ' filter.'
984
- ) ;
978
+ expect ( ( ) =>
979
+ query (
980
+ collection ( db , 'test' ) ,
981
+ where ( 'foo' , 'array-contains-any' , [ 1 , 2 ] ) ,
982
+ where ( 'foo' , 'array-contains-any' , [ 2 , 3 ] )
983
+ )
984
+ ) . to . throw (
985
+ "Invalid query. You cannot use more than one 'array-contains-any'" +
986
+ ' filter.'
987
+ ) ;
985
988
986
- expect ( ( ) =>
987
- query (
988
- collection ( db , 'test' ) ,
989
- where ( 'foo' , 'not-in' , [ 2 , 3 ] ) ,
990
- where ( 'foo' , 'array-contains-any' , [ 2 , 3 ] )
991
- )
992
- ) . to . throw (
993
- "Invalid query. You cannot use 'array-contains-any' filters with " +
994
- "'not-in' filters."
995
- ) ;
989
+ expect ( ( ) =>
990
+ query (
991
+ collection ( db , 'test' ) ,
992
+ where ( 'foo' , 'not-in' , [ 2 , 3 ] ) ,
993
+ where ( 'foo' , 'array-contains-any' , [ 2 , 3 ] )
994
+ )
995
+ ) . to . throw (
996
+ "Invalid query. You cannot use 'array-contains-any' filters with " +
997
+ "'not-in' filters."
998
+ ) ;
996
999
997
- expect ( ( ) =>
998
- query (
999
- collection ( db , 'test' ) ,
1000
- where ( 'foo' , 'array-contains-any' , [ 2 , 3 ] ) ,
1001
- where ( 'foo' , 'not-in' , [ 2 , 3 ] )
1002
- )
1003
- ) . to . throw (
1004
- "Invalid query. You cannot use 'not-in' filters with " +
1005
- "'array-contains-any' filters."
1006
- ) ;
1000
+ expect ( ( ) =>
1001
+ query (
1002
+ collection ( db , 'test' ) ,
1003
+ where ( 'foo' , 'array-contains-any' , [ 2 , 3 ] ) ,
1004
+ where ( 'foo' , 'not-in' , [ 2 , 3 ] )
1005
+ )
1006
+ ) . to . throw (
1007
+ "Invalid query. You cannot use 'not-in' filters with " +
1008
+ "'array-contains-any' filters."
1009
+ ) ;
1007
1010
1008
- expect ( ( ) =>
1009
- query (
1010
- collection ( db , 'test' ) ,
1011
- where ( 'foo' , 'not-in' , [ 2 , 3 ] ) ,
1012
- where ( 'foo' , 'in' , [ 2 , 3 ] )
1013
- )
1014
- ) . to . throw (
1015
- "Invalid query. You cannot use 'in' filters with 'not-in' filters."
1016
- ) ;
1011
+ expect ( ( ) =>
1012
+ query (
1013
+ collection ( db , 'test' ) ,
1014
+ where ( 'foo' , 'not-in' , [ 2 , 3 ] ) ,
1015
+ where ( 'foo' , 'in' , [ 2 , 3 ] )
1016
+ )
1017
+ ) . to . throw (
1018
+ "Invalid query. You cannot use 'in' filters with 'not-in' filters."
1019
+ ) ;
1017
1020
1018
- expect ( ( ) =>
1019
- query (
1020
- collection ( db , 'test' ) ,
1021
- where ( 'foo' , 'in' , [ 2 , 3 ] ) ,
1022
- where ( 'foo' , 'not-in' , [ 2 , 3 ] )
1023
- )
1024
- ) . to . throw (
1025
- "Invalid query. You cannot use 'not-in' filters with 'in' filters."
1026
- ) ;
1021
+ expect ( ( ) =>
1022
+ query (
1023
+ collection ( db , 'test' ) ,
1024
+ where ( 'foo' , 'in' , [ 2 , 3 ] ) ,
1025
+ where ( 'foo' , 'not-in' , [ 2 , 3 ] )
1026
+ )
1027
+ ) . to . throw (
1028
+ "Invalid query. You cannot use 'not-in' filters with 'in' filters."
1029
+ ) ;
1027
1030
1028
- expect ( ( ) =>
1029
- query (
1030
- collection ( db , 'test' ) ,
1031
- where ( 'foo' , 'array-contains' , 1 ) ,
1032
- where ( 'foo' , 'in' , [ 2 , 3 ] ) ,
1033
- where ( 'foo' , 'array-contains-any' , [ 2 ] )
1034
- )
1035
- ) . to . throw (
1036
- "Invalid query. You cannot use 'array-contains-any' filters with " +
1037
- "'array-contains' filters."
1038
- ) ;
1031
+ // This is redundant with the above tests, but makes sure our validation
1032
+ // doesn't get confused.
1033
+ expect ( ( ) =>
1034
+ query (
1035
+ collection ( db , 'test' ) ,
1036
+ where ( 'foo' , 'in' , [ 2 , 3 ] ) ,
1037
+ where ( 'foo' , 'array-contains' , 1 ) ,
1038
+ where ( 'foo' , 'array-contains-any' , [ 2 ] )
1039
+ )
1040
+ ) . to . throw (
1041
+ "Invalid query. You cannot use 'array-contains-any' filters with 'array-contains' filters."
1042
+ ) ;
1039
1043
1040
- expect ( ( ) =>
1041
- query (
1042
- collection ( db , 'test' ) ,
1043
- where ( 'foo' , 'not-in ' , [ 2 , 3 ] ) ,
1044
- where ( 'foo' , 'array-contains ' , 2 ) ,
1045
- where ( 'foo' , 'array-contains-any' , [ 2 ] )
1046
- )
1047
- ) . to . throw (
1048
- "Invalid query. You cannot use 'array-contains' filters with " +
1049
- "'not-in ' filters."
1050
- ) ;
1044
+ expect ( ( ) =>
1045
+ query (
1046
+ collection ( db , 'test' ) ,
1047
+ where ( 'foo' , 'array-contains ' , 1 ) ,
1048
+ where ( 'foo' , 'in ' , [ 2 , 3 ] ) ,
1049
+ where ( 'foo' , 'array-contains-any' , [ 2 ] )
1050
+ )
1051
+ ) . to . throw (
1052
+ "Invalid query. You cannot use 'array-contains-any ' filters with " +
1053
+ "'array-contains ' filters."
1054
+ ) ;
1051
1055
1052
- expect ( ( ) =>
1053
- query (
1054
- collection ( db , 'test' ) ,
1055
- where ( 'foo' , 'array-contains' , 2 ) ,
1056
- where ( 'foo' , 'in' , [ 2 ] ) ,
1057
- where ( 'foo' , 'not-in' , [ 2 , 3 ] )
1058
- )
1059
- ) . to . throw (
1060
- "Invalid query. You cannot use 'not-in' filters with " +
1061
- "'array-contains' filters."
1062
- ) ;
1063
- } ) ;
1056
+ expect ( ( ) =>
1057
+ query (
1058
+ collection ( db , 'test' ) ,
1059
+ where ( 'foo' , 'not-in' , [ 2 , 3 ] ) ,
1060
+ where ( 'foo' , 'array-contains' , 2 ) ,
1061
+ where ( 'foo' , 'array-contains-any' , [ 2 ] )
1062
+ )
1063
+ ) . to . throw (
1064
+ "Invalid query. You cannot use 'array-contains' filters with " +
1065
+ "'not-in' filters."
1066
+ ) ;
1067
+
1068
+ expect ( ( ) =>
1069
+ query (
1070
+ collection ( db , 'test' ) ,
1071
+ where ( 'foo' , 'array-contains' , 2 ) ,
1072
+ where ( 'foo' , 'in' , [ 2 ] ) ,
1073
+ where ( 'foo' , 'not-in' , [ 2 , 3 ] )
1074
+ )
1075
+ ) . to . throw (
1076
+ "Invalid query. You cannot use 'not-in' filters with " +
1077
+ "'array-contains' filters."
1078
+ ) ;
1079
+ }
1080
+ ) ;
1064
1081
1065
1082
validationIt (
1066
1083
persistence ,
0 commit comments