Skip to content

Commit 44b61ee

Browse files
Use v9 API in tests
1 parent 4f3662b commit 44b61ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2607
-2692
lines changed

packages/firestore/package.json

-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
"test:lite:prod": "node ./scripts/run-tests.js --platform node_lite --main=lite/index.ts 'test/lite/**/*.test.ts'",
2626
"test:lite:browser": "karma start --single-run --lite",
2727
"test:lite:browser:debug": "karma start --browsers=Chrome --lite --auto-watch",
28-
"pretest": "yarn test:prepare",
29-
"pretest:ci": "yarn pretest",
3028
"test": "run-s lint test:all",
3129
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all:ci",
3230
"test:all:ci": "run-p test:browser test:lite:browser test:travis",
@@ -44,7 +42,6 @@
4442
"api-report:api-json": "rm -rf temp && api-extractor run --local --verbose",
4543
"api-report": "run-s api-report:main api-report:lite && yarn api-report:api-json",
4644
"doc": "api-documenter markdown --input temp --output docs",
47-
"test:prepare": "node ./scripts/prepare-test.js",
4845
"typings:public": "node ../../scripts/build/use_typings.js ./dist/index.d.ts"
4946
},
5047
"exports": {

packages/firestore/scripts/prepare-test.js

-18
This file was deleted.

packages/firestore/scripts/prepare-test.ts

-84
This file was deleted.

packages/firestore/src/api.ts

+2
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ export { FirestoreErrorCode, FirestoreError } from './util/error';
133133

134134
export { AbstractUserDataWriter } from './lite-api/user_data_writer';
135135

136+
export { FirestoreSettings as Settings } from './lite-api/settings';
137+
136138
export {
137139
Primitive,
138140
NestedUpdateFields,

packages/firestore/src/api/snapshot.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ import { SnapshotListenOptions } from './reference_impl';
5959
* }
6060
*
6161
* const postConverter = {
62-
* toFirestore(post: WithFieldValue<Post>): firebase.firestore.DocumentData {
62+
* toFirestore(post: WithFieldValue<Post>): DocumentData {
6363
* return {title: post.title, author: post.author};
6464
* },
6565
* fromFirestore(
66-
* snapshot: firebase.firestore.QueryDocumentSnapshot,
67-
* options: firebase.firestore.SnapshotOptions
66+
* snapshot: QueryDocumentSnapshot,
67+
* options: SnapshotOptions
6868
* ): Post {
6969
* const data = snapshot.data(options)!;
7070
* return new Post(data.title, data.author);
@@ -269,7 +269,7 @@ export class DocumentSnapshot<
269269
* Retrieves all fields in the document as an `Object`. Returns `undefined` if
270270
* the document doesn't exist.
271271
*
272-
* By default, `FieldValue.serverTimestamp()` values that have not yet been
272+
* By default, `serverTimestamp()` values that have not yet been
273273
* set to their final value will be returned as `null`. You can override
274274
* this by passing an options object.
275275
*
@@ -306,7 +306,7 @@ export class DocumentSnapshot<
306306
* Retrieves the field specified by `fieldPath`. Returns `undefined` if the
307307
* document or field doesn't exist.
308308
*
309-
* By default, a `FieldValue.serverTimestamp()` that has not yet been set to
309+
* By default, a `serverTimestamp()` that has not yet been set to
310310
* its final value will be returned as `null`. You can override this by
311311
* passing an options object.
312312
*
@@ -353,7 +353,7 @@ export class QueryDocumentSnapshot<
353353
/**
354354
* Retrieves all fields in the document as an `Object`.
355355
*
356-
* By default, `FieldValue.serverTimestamp()` values that have not yet been
356+
* By default, `serverTimestamp()` values that have not yet been
357357
* set to their final value will be returned as `null`. You can override
358358
* this by passing an options object.
359359
*

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

+7-8
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,7 @@ export function newQueryFilter(
480480
if (op === Operator.ARRAY_CONTAINS || op === Operator.ARRAY_CONTAINS_ANY) {
481481
throw new FirestoreError(
482482
Code.INVALID_ARGUMENT,
483-
`Invalid Query. You can't perform '${op}' ` +
484-
'queries on FieldPath.documentId().'
483+
`Invalid Query. You can't perform '${op}' ` + 'queries on documentId().'
485484
);
486485
} else if (op === Operator.IN || op === Operator.NOT_IN) {
487486
validateDisjunctiveFilterElements(value, op);
@@ -639,7 +638,7 @@ export function newQueryBoundFromFields(
639638
if (!isCollectionGroupQuery(query) && rawValue.indexOf('/') !== -1) {
640639
throw new FirestoreError(
641640
Code.INVALID_ARGUMENT,
642-
`Invalid query. When querying a collection and ordering by FieldPath.documentId(), ` +
641+
`Invalid query. When querying a collection and ordering by documentId(), ` +
643642
`the value passed to ${methodName}() must be a plain document ID, but ` +
644643
`'${rawValue}' contains a slash.`
645644
);
@@ -649,7 +648,7 @@ export function newQueryBoundFromFields(
649648
throw new FirestoreError(
650649
Code.INVALID_ARGUMENT,
651650
`Invalid query. When querying a collection group and ordering by ` +
652-
`FieldPath.documentId(), the value passed to ${methodName}() must result in a ` +
651+
`documentId(), the value passed to ${methodName}() must result in a ` +
653652
`valid document path, but '${path}' is not because it contains an odd number ` +
654653
`of segments.`
655654
);
@@ -681,15 +680,15 @@ function parseDocumentIdValue(
681680
if (documentIdValue === '') {
682681
throw new FirestoreError(
683682
Code.INVALID_ARGUMENT,
684-
'Invalid query. When querying with FieldPath.documentId(), you ' +
683+
'Invalid query. When querying with documentId(), you ' +
685684
'must provide a valid document ID, but it was an empty string.'
686685
);
687686
}
688687
if (!isCollectionGroupQuery(query) && documentIdValue.indexOf('/') !== -1) {
689688
throw new FirestoreError(
690689
Code.INVALID_ARGUMENT,
691690
`Invalid query. When querying a collection by ` +
692-
`FieldPath.documentId(), you must provide a plain document ID, but ` +
691+
`documentId(), you must provide a plain document ID, but ` +
693692
`'${documentIdValue}' contains a '/' character.`
694693
);
695694
}
@@ -698,7 +697,7 @@ function parseDocumentIdValue(
698697
throw new FirestoreError(
699698
Code.INVALID_ARGUMENT,
700699
`Invalid query. When querying a collection group by ` +
701-
`FieldPath.documentId(), the value provided must result in a valid document path, ` +
700+
`documentId(), the value provided must result in a valid document path, ` +
702701
`but '${path}' is not because it has an odd number of segments (${path.length}).`
703702
);
704703
}
@@ -708,7 +707,7 @@ function parseDocumentIdValue(
708707
} else {
709708
throw new FirestoreError(
710709
Code.INVALID_ARGUMENT,
711-
`Invalid query. When querying with FieldPath.documentId(), you must provide a valid ` +
710+
`Invalid query. When querying with documentId(), you must provide a valid ` +
712711
`string or a DocumentReference, but it was: ` +
713712
`${valueDescription(documentIdValue)}.`
714713
);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ import { AbstractUserDataWriter } from './user_data_writer';
5757
* }
5858
*
5959
* const postConverter = {
60-
* toFirestore(post: WithFieldValue<Post>): firebase.firestore.DocumentData {
60+
* toFirestore(post: WithFieldValue<Post>): DocumentData {
6161
* return {title: post.title, author: post.author};
6262
* },
63-
* fromFirestore(snapshot: firebase.firestore.QueryDocumentSnapshot): Post {
63+
* fromFirestore(snapshot: QueryDocumentSnapshot): Post {
6464
* const data = snapshot.data(options)!;
6565
* return new Post(data.title, data.author);
6666
* }

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ export function parseData(
722722
validatePlainObject('Unsupported field value:', context, input);
723723
return parseObject(input, context);
724724
} else if (input instanceof FieldValue) {
725-
// FieldValues usually parse into transforms (except FieldValue.delete())
725+
// FieldValues usually parse into transforms (except deleteField())
726726
// in which case we do not want to include this field in our parsed data
727727
// (as doing so will overwrite the field directly prior to the transform
728728
// trying to transform it). So we don't add this location to

0 commit comments

Comments
 (0)