@@ -1056,6 +1056,46 @@ describe(' firestore().collection().where(AND Filters)', function () {
10561056 } ) ;
10571057 } ) ;
10581058
1059+ it ( 'returns with single where "==" in or filter' , async function ( ) {
1060+ const { getFirestore, collection, addDoc, getDocs, query, where, and } = firestoreModular ;
1061+ const colRef = collection ( getFirestore ( ) , `${ COLLECTION } /filter/single-or` ) ;
1062+
1063+ const expected = { foo : 'bar' , baz : 'baz' } ;
1064+ const notExpected = { foo : 'bar' , baz : 'something' } ;
1065+ await Promise . all ( [
1066+ addDoc ( colRef , notExpected ) ,
1067+ addDoc ( colRef , expected ) ,
1068+ addDoc ( colRef , expected ) ,
1069+ ] ) ;
1070+
1071+ const snapshot = await getDocs ( query ( colRef , and ( where ( 'baz' , '==' , 'baz' ) ) ) ) ;
1072+
1073+ snapshot . size . should . eql ( 2 ) ;
1074+ snapshot . forEach ( s => {
1075+ s . data ( ) . should . eql ( jet . contextify ( expected ) ) ;
1076+ } ) ;
1077+ } ) ;
1078+
1079+ it ( 'returns with single where "==" in and filter' , async function ( ) {
1080+ const { getFirestore, collection, addDoc, getDocs, query, where, or } = firestoreModular ;
1081+ const colRef = collection ( getFirestore ( ) , `${ COLLECTION } /filter/single-and` ) ;
1082+
1083+ const expected = { foo : 'bar' , baz : 'baz' } ;
1084+ const notExpected = { foo : 'bar' , baz : 'something' } ;
1085+ await Promise . all ( [
1086+ addDoc ( colRef , notExpected ) ,
1087+ addDoc ( colRef , expected ) ,
1088+ addDoc ( colRef , expected ) ,
1089+ ] ) ;
1090+
1091+ const snapshot = await getDocs ( query ( colRef , or ( where ( 'baz' , '==' , 'baz' ) ) ) ) ;
1092+
1093+ snapshot . size . should . eql ( 2 ) ;
1094+ snapshot . forEach ( s => {
1095+ s . data ( ) . should . eql ( jet . contextify ( expected ) ) ;
1096+ } ) ;
1097+ } ) ;
1098+
10591099 it ( 'returns with where "==" & ">" filter' , async function ( ) {
10601100 const { getFirestore, collection, addDoc, getDocs, query, where, and } = firestoreModular ;
10611101 const colRef = collection ( getFirestore ( ) , `${ COLLECTION } /filter/equals` ) ;
0 commit comments