Skip to content

Commit 9d12961

Browse files
authored
Merge 9add7c8 into 9952dbc
2 parents 9952dbc + 9add7c8 commit 9d12961

File tree

5 files changed

+111
-10
lines changed

5 files changed

+111
-10
lines changed

packages/firestore/test/integration/api/composite_index_query.test.ts

+12
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ apiDescribe('Composite Index Queries', persistence => {
7373
return testHelper.withTestDocs(persistence, testDocs, async coll => {
7474
// a == 1, limit 2, b - desc
7575
await testHelper.assertOnlineAndOfflineResultsMatch(
76+
coll,
7677
testHelper.query(
7778
coll,
7879
where('a', '==', 1),
@@ -97,6 +98,7 @@ apiDescribe('Composite Index Queries', persistence => {
9798
return testHelper.withTestDocs(persistence, testDocs, async coll => {
9899
// with one inequality: a>2 || b==1.
99100
await testHelper.assertOnlineAndOfflineResultsMatch(
101+
coll,
100102
testHelper.compositeQuery(
101103
coll,
102104
or(where('a', '>', 2), where('b', '==', 1))
@@ -108,6 +110,7 @@ apiDescribe('Composite Index Queries', persistence => {
108110

109111
// Test with limits (implicit order by ASC): (a==1) || (b > 0) LIMIT 2
110112
await testHelper.assertOnlineAndOfflineResultsMatch(
113+
coll,
111114
testHelper.compositeQuery(
112115
coll,
113116
or(where('a', '==', 1), where('b', '>', 0)),
@@ -120,6 +123,7 @@ apiDescribe('Composite Index Queries', persistence => {
120123
// Test with limits (explicit order by): (a==1) || (b > 0) LIMIT_TO_LAST 2
121124
// Note: The public query API does not allow implicit ordering when limitToLast is used.
122125
await testHelper.assertOnlineAndOfflineResultsMatch(
126+
coll,
123127
testHelper.compositeQuery(
124128
coll,
125129
or(where('a', '==', 1), where('b', '>', 0)),
@@ -132,6 +136,7 @@ apiDescribe('Composite Index Queries', persistence => {
132136

133137
// Test with limits (explicit order by ASC): (a==2) || (b == 1) ORDER BY a LIMIT 1
134138
await testHelper.assertOnlineAndOfflineResultsMatch(
139+
coll,
135140
testHelper.compositeQuery(
136141
coll,
137142
or(where('a', '==', 2), where('b', '==', 1)),
@@ -143,6 +148,7 @@ apiDescribe('Composite Index Queries', persistence => {
143148

144149
// Test with limits (explicit order by DESC): (a==2) || (b == 1) ORDER BY a LIMIT_TO_LAST 1
145150
await testHelper.assertOnlineAndOfflineResultsMatch(
151+
coll,
146152
testHelper.compositeQuery(
147153
coll,
148154
or(where('a', '==', 2), where('b', '==', 1)),
@@ -857,12 +863,14 @@ apiDescribe('Composite Index Queries', persistence => {
857863
return testHelper.withTestDocs(persistence, testDocs, async coll => {
858864
// implicit AND: a != 1 && b < 2
859865
await testHelper.assertOnlineAndOfflineResultsMatch(
866+
coll,
860867
testHelper.query(coll, where('a', '!=', 1), where('b', '<', 2)),
861868
'doc2'
862869
);
863870

864871
// explicit AND: a != 1 && b < 2
865872
await testHelper.assertOnlineAndOfflineResultsMatch(
873+
coll,
866874
testHelper.compositeQuery(
867875
coll,
868876
and(where('a', '!=', 1), where('b', '<', 2))
@@ -873,6 +881,7 @@ apiDescribe('Composite Index Queries', persistence => {
873881
// explicit AND: a < 3 && b not-in [2, 3]
874882
// Implicitly ordered by: a asc, b asc, __name__ asc
875883
await testHelper.assertOnlineAndOfflineResultsMatch(
884+
coll,
876885
testHelper.compositeQuery(
877886
coll,
878887
and(where('a', '<', 3), where('b', 'not-in', [2, 3]))
@@ -884,6 +893,7 @@ apiDescribe('Composite Index Queries', persistence => {
884893

885894
// a <3 && b != 0, implicitly ordered by: a asc, b asc, __name__ asc
886895
await testHelper.assertOnlineAndOfflineResultsMatch(
896+
coll,
887897
testHelper.query(
888898
coll,
889899
where('b', '!=', 0),
@@ -896,6 +906,7 @@ apiDescribe('Composite Index Queries', persistence => {
896906

897907
// a <3 && b != 0, ordered by: b desc, a desc, __name__ desc
898908
await testHelper.assertOnlineAndOfflineResultsMatch(
909+
coll,
899910
testHelper.query(
900911
coll,
901912
where('a', '<', 3),
@@ -909,6 +920,7 @@ apiDescribe('Composite Index Queries', persistence => {
909920

910921
// explicit OR: multiple inequality: a>2 || b<1.
911922
await testHelper.assertOnlineAndOfflineResultsMatch(
923+
coll,
912924
testHelper.compositeQuery(
913925
coll,
914926
or(where('a', '>', 2), where('b', '<', 1))

packages/firestore/test/integration/api/database.test.ts

+34-6
Original file line numberDiff line numberDiff line change
@@ -780,14 +780,19 @@ apiDescribe('Database', persistence => {
780780

781781
return withTestCollection(persistence, docs, async randomCol => {
782782
const orderedQuery = query(randomCol, orderBy('embedding'));
783-
await checkOnlineAndOfflineResultsMatch(orderedQuery, ...documentIds);
783+
await checkOnlineAndOfflineResultsMatch(
784+
randomCol,
785+
orderedQuery,
786+
...documentIds
787+
);
784788

785789
const orderedQueryLessThan = query(
786790
randomCol,
787791
orderBy('embedding'),
788792
where('embedding', '<', vector([1, 2, 100, 4, 4]))
789793
);
790794
await checkOnlineAndOfflineResultsMatch(
795+
randomCol,
791796
orderedQueryLessThan,
792797
...documentIds.slice(2, 11)
793798
);
@@ -798,6 +803,7 @@ apiDescribe('Database', persistence => {
798803
where('embedding', '>', vector([1, 2, 100, 4, 4]))
799804
);
800805
await checkOnlineAndOfflineResultsMatch(
806+
randomCol,
801807
orderedQueryGreaterThan,
802808
...documentIds.slice(12, 13)
803809
);
@@ -2396,6 +2402,7 @@ apiDescribe('Database', persistence => {
23962402
'a'
23972403
];
23982404
await checkOnlineAndOfflineResultsMatch(
2405+
collectionRef,
23992406
orderedQuery,
24002407
...expectedDocs
24012408
);
@@ -2416,6 +2423,7 @@ apiDescribe('Database', persistence => {
24162423
'Aa'
24172424
];
24182425
await checkOnlineAndOfflineResultsMatch(
2426+
collectionRef,
24192427
filteredQuery,
24202428
...expectedDocs
24212429
);
@@ -2467,7 +2475,11 @@ apiDescribe('Database', persistence => {
24672475

24682476
unsubscribe();
24692477

2470-
await checkOnlineAndOfflineResultsMatch(orderedQuery, ...expectedDocs);
2478+
await checkOnlineAndOfflineResultsMatch(
2479+
collectionRef,
2480+
orderedQuery,
2481+
...expectedDocs
2482+
);
24712483
});
24722484
});
24732485

@@ -2499,7 +2511,11 @@ apiDescribe('Database', persistence => {
24992511

25002512
unsubscribe();
25012513

2502-
await checkOnlineAndOfflineResultsMatch(orderedQuery, ...expectedDocs);
2514+
await checkOnlineAndOfflineResultsMatch(
2515+
collectionRef,
2516+
orderedQuery,
2517+
...expectedDocs
2518+
);
25032519
});
25042520
});
25052521

@@ -2531,7 +2547,11 @@ apiDescribe('Database', persistence => {
25312547

25322548
unsubscribe();
25332549

2534-
await checkOnlineAndOfflineResultsMatch(orderedQuery, ...expectedDocs);
2550+
await checkOnlineAndOfflineResultsMatch(
2551+
collectionRef,
2552+
orderedQuery,
2553+
...expectedDocs
2554+
);
25352555
});
25362556
});
25372557

@@ -2563,7 +2583,11 @@ apiDescribe('Database', persistence => {
25632583

25642584
unsubscribe();
25652585

2566-
await checkOnlineAndOfflineResultsMatch(orderedQuery, ...expectedDocs);
2586+
await checkOnlineAndOfflineResultsMatch(
2587+
collectionRef,
2588+
orderedQuery,
2589+
...expectedDocs
2590+
);
25672591
});
25682592
});
25692593

@@ -2608,7 +2632,11 @@ apiDescribe('Database', persistence => {
26082632

26092633
unsubscribe();
26102634

2611-
await checkOnlineAndOfflineResultsMatch(orderedQuery, ...expectedDocs);
2635+
await checkOnlineAndOfflineResultsMatch(
2636+
collectionRef,
2637+
orderedQuery,
2638+
...expectedDocs
2639+
);
26122640
});
26132641
});
26142642

0 commit comments

Comments
 (0)