Skip to content

Commit 609d082

Browse files
committed
Pipeline and test cleanup
1 parent 8e9fdbe commit 609d082

File tree

5 files changed

+724
-581
lines changed

5 files changed

+724
-581
lines changed

packages/firestore/src/core/pipeline-util.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ function whereConditionsFromCursor(
255255
const cursors = bound.position.map(value => Constant._fromProto(value));
256256
const size = cursors.length;
257257

258-
let field = orderings[size-1].expr;
259-
let value = cursors[size-1];
258+
let field = orderings[size - 1].expr;
259+
let value = cursors[size - 1];
260260

261261
// Add condition for last bound
262262
let condition: BooleanExpr = filterFunc(field, value);
@@ -275,9 +275,7 @@ function whereConditionsFromCursor(
275275
// For each field in the orderings, the condition is either
276276
// a) lt|gt the cursor value,
277277
// b) or equal the cursor value and lt|gt the cursor values for other fields
278-
condition = or(
279-
filterFunc(field, value),
280-
and(field.eq(value), condition));
278+
condition = or(filterFunc(field, value), and(field.eq(value), condition));
281279
}
282280

283281
return condition;

packages/firestore/src/lite-api/expressions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2247,7 +2247,7 @@ export function field(nameOrPath: string | FieldPath): Field {
22472247
if (DOCUMENT_KEY_NAME === nameOrPath) {
22482248
return new Field(documentIdFieldPath()._internalPath);
22492249
}
2250-
return new Field(fieldPathFromArgument('of', nameOrPath));
2250+
return new Field(fieldPathFromArgument('field', nameOrPath));
22512251
} else {
22522252
return new Field(nameOrPath._internalPath);
22532253
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ import {
5353
collection,
5454
documentId as documentIdFieldPath,
5555
writeBatch,
56-
addDoc
56+
addDoc,
57+
increment
5758
} from '../util/firebase_export';
5859
import { apiDescribe, withTestCollection, itIf } from '../util/helpers';
5960
import {
@@ -144,17 +145,16 @@ use(chaiAsPromised);
144145
setLogLevel('debug');
145146

146147
const testUnsupportedFeatures = false;
148+
const timestampDeltaMS = 1000;
147149

148-
apiDescribe.only('Pipelines', persistence => {
150+
apiDescribe('Pipelines', persistence => {
149151
addEqualityMatcher();
150152

151153
let firestore: Firestore;
152154
let randomCol: CollectionReference;
153155
let beginDocCreation: number = 0;
154156
let endDocCreation: number = 0;
155157

156-
const timestampDeltaMS = 1000;
157-
158158
async function testCollectionWithDocs(docs: {
159159
[id: string]: DocumentData;
160160
}): Promise<CollectionReference<DocumentData>> {
@@ -2388,7 +2388,7 @@ apiDescribe.only('Pipelines', persistence => {
23882388
.collection(randomCol.path)
23892389
.sort(field('rating').descending())
23902390
.limit(1)
2391-
.select(
2391+
.addFields(
23922392
map({
23932393
foo: 'bar'
23942394
}).as('metadata')

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const testUnsupportedFeatures = false;
5959

6060
// This is the Query integration tests from the lite API (no cache support)
6161
// with some additional test cases added for more complete coverage.
62-
apiDescribe.only('Query to Pipeline', persistence => {
62+
apiDescribe('Query to Pipeline', persistence => {
6363
addEqualityMatcher();
6464

6565
function verifyResults(
@@ -632,7 +632,8 @@ apiDescribe.only('Query to Pipeline', persistence => {
632632
PERSISTENCE_MODE_UNSPECIFIED,
633633
{
634634
1: { foo: 1, bar: NaN },
635-
2: { foo: 2, bar: 1 }
635+
2: { foo: 2, bar: 1 },
636+
3: { foo: 3, bar: 'bar' }
636637
},
637638
async (collRef, db) => {
638639
const query1 = query(collRef, where('bar', '==', NaN));
@@ -647,7 +648,8 @@ apiDescribe.only('Query to Pipeline', persistence => {
647648
PERSISTENCE_MODE_UNSPECIFIED,
648649
{
649650
1: { foo: 1, bar: NaN },
650-
2: { foo: 2, bar: 1 }
651+
2: { foo: 2, bar: 1 },
652+
3: { foo: 3, bar: 'bar' }
651653
},
652654
async (collRef, db) => {
653655
const query1 = query(collRef, where('bar', '!=', NaN));

0 commit comments

Comments
 (0)