File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
packages/firestore/test/integration/api
scripts/emulator-testing/emulators Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -1912,6 +1912,34 @@ apiDescribe('Queries', persistence => {
1912
1912
} ) ;
1913
1913
}
1914
1914
) ;
1915
+
1916
+ it ( 'inequality query will reject if document key is not the last orderBy field' , ( ) => {
1917
+ return withEmptyTestCollection ( persistence , async coll => {
1918
+ // Implicitly ordered by: __name__ asc, 'key' asc,
1919
+ const queryForRejection = query (
1920
+ coll ,
1921
+ where ( 'key' , '!=' , 42 ) ,
1922
+ orderBy ( documentId ( ) )
1923
+ ) ;
1924
+
1925
+ await expect ( getDocs ( queryForRejection ) ) . to . be . eventually . rejectedWith (
1926
+ 'order by clause cannot contain more fields after the key'
1927
+ ) ;
1928
+ } ) ;
1929
+ } ) ;
1930
+
1931
+ it ( 'inequality query will reject if document key appears only in equality filter' , ( ) => {
1932
+ return withEmptyTestCollection ( persistence , async coll => {
1933
+ const query_ = query (
1934
+ coll ,
1935
+ where ( 'key' , '!=' , 42 ) ,
1936
+ where ( documentId ( ) , '==' , 'doc1' )
1937
+ ) ;
1938
+ await expect ( getDocs ( query_ ) ) . to . be . eventually . rejectedWith (
1939
+ 'Equality on key is not allowed if there are other inequality fields and key does not appear in inequalities.'
1940
+ ) ;
1941
+ } ) ;
1942
+ } ) ;
1915
1943
} ) ;
1916
1944
1917
1945
// OR Query tests only run when the SDK's local cache is configured to use
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ export class FirestoreEmulator extends Emulator {
26
26
// Use locked version of emulator for test to be deterministic.
27
27
// The latest version can be found from firestore emulator doc:
28
28
// https://firebase.google.com/docs/firestore/security/test-rules-emulator
29
- 'https://storage.googleapis.com/firebase-preview-drop/emulator/cloud-firestore-emulator-v1.18.1 .jar' ,
29
+ 'https://storage.googleapis.com/firebase-preview-drop/emulator/cloud-firestore-emulator-v1.18.2 .jar' ,
30
30
port
31
31
) ;
32
32
this . projectId = projectId ;
You can’t perform that action at this time.
0 commit comments