From 72ee4ff9d7b2000d4f7f5ecd99427e4b23e36d36 Mon Sep 17 00:00:00 2001 From: Mark Duckworth <1124037+MarkDuckworth@users.noreply.github.com> Date: Fri, 14 Feb 2025 16:08:28 -0700 Subject: [PATCH 1/4] Update WithFieldData and PartialWithFieldData to ignore methods on types --- dev/test/types.ts | 38 ++++++++++++++++++++++++++++++++++++++ types/firestore.d.ts | 20 ++++++++++++++------ 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/dev/test/types.ts b/dev/test/types.ts index 98296980a..10aba2600 100644 --- a/dev/test/types.ts +++ b/dev/test/types.ts @@ -226,6 +226,44 @@ describe('FirestoreTypeConverter', () => { })); }); +describe('WithFieldValue', () => { + it('does not affect functions on types', () => { + type SampleType = { + bar: string; + foo: () => void; + }; + /* eslint-disable @typescript-eslint/no-unused-vars */ + function test(x: WithFieldValue) { + // @ts-expect-error This should fail because x.bar is type `string | FieldValue` + const b: string = x.bar; + + // ASSERT: if WithFieldValue applies FieldValue | K[T] + // to methods on the type, then this line will not compile + const f: () => void = x.foo; + } + /* eslint-enable @typescript-eslint/no-unused-vars */ + }); +}); + +describe('PartialWithFieldValue', () => { + it('does not affect functions on types', () => { + type SampleType = { + bar: string; + foo: () => void; + }; + /* eslint-disable @typescript-eslint/no-unused-vars */ + function test(x: PartialWithFieldValue) { + // @ts-expect-error This should fail because x.bar is type `string | FieldValue` + const b: string = x.bar; + + // ASSERT: if WithFieldValue applies FieldValue | K[T] + // to methods on the type, then this line will not compile + const f: undefined | (() => void) = x.foo; + } + /* eslint-enable @typescript-eslint/no-unused-vars */ + }); +}); + /** * Does nothing; however, this function can be useful in tests that only check * the compile-time behavior of the TypeScript compiler. For example, a test diff --git a/types/firestore.d.ts b/types/firestore.d.ts index cfff47c98..3cbcd51d3 100644 --- a/types/firestore.d.ts +++ b/types/firestore.d.ts @@ -40,8 +40,12 @@ declare namespace FirebaseFirestore { | (T extends Primitive ? T : T extends {} - ? {[K in keyof T]?: PartialWithFieldValue | FieldValue} - : never); + ? { + [K in keyof T]?: T[K] extends Function + ? T[K] + : PartialWithFieldValue | FieldValue; + } + : never); /** * Allows FieldValues to be passed in as a property value while maintaining @@ -52,8 +56,12 @@ declare namespace FirebaseFirestore { | (T extends Primitive ? T : T extends {} - ? {[K in keyof T]: WithFieldValue | FieldValue} - : never); + ? { + [K in keyof T]: T[K] extends Function + ? T[K] + : WithFieldValue | FieldValue; + } + : never); /** * Update data (for use with [update]{@link DocumentReference#update}) @@ -72,8 +80,8 @@ declare namespace FirebaseFirestore { export type UpdateData = T extends Primitive ? T : T extends {} - ? {[K in keyof T]?: UpdateData | FieldValue} & NestedUpdateFields - : Partial; + ? {[K in keyof T]?: UpdateData | FieldValue} & NestedUpdateFields + : Partial; /** Primitive types. */ export type Primitive = string | number | boolean | undefined | null; From cc0edeeaad352c4abbadce7d6959a9052d790d08 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 14 Feb 2025 23:15:08 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- types/firestore.d.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/types/firestore.d.ts b/types/firestore.d.ts index 3cbcd51d3..1aafb33e1 100644 --- a/types/firestore.d.ts +++ b/types/firestore.d.ts @@ -40,12 +40,12 @@ declare namespace FirebaseFirestore { | (T extends Primitive ? T : T extends {} - ? { - [K in keyof T]?: T[K] extends Function - ? T[K] - : PartialWithFieldValue | FieldValue; - } - : never); + ? { + [K in keyof T]?: T[K] extends Function + ? T[K] + : PartialWithFieldValue | FieldValue; + } + : never); /** * Allows FieldValues to be passed in as a property value while maintaining @@ -56,12 +56,12 @@ declare namespace FirebaseFirestore { | (T extends Primitive ? T : T extends {} - ? { - [K in keyof T]: T[K] extends Function - ? T[K] - : WithFieldValue | FieldValue; - } - : never); + ? { + [K in keyof T]: T[K] extends Function + ? T[K] + : WithFieldValue | FieldValue; + } + : never); /** * Update data (for use with [update]{@link DocumentReference#update}) @@ -80,8 +80,8 @@ declare namespace FirebaseFirestore { export type UpdateData = T extends Primitive ? T : T extends {} - ? {[K in keyof T]?: UpdateData | FieldValue} & NestedUpdateFields - : Partial; + ? {[K in keyof T]?: UpdateData | FieldValue} & NestedUpdateFields + : Partial; /** Primitive types. */ export type Primitive = string | number | boolean | undefined | null; From 6d6ca7353380f47ffcfed1ca7bc432f1433facf4 Mon Sep 17 00:00:00 2001 From: Mark Duckworth <1124037+MarkDuckworth@users.noreply.github.com> Date: Tue, 18 Feb 2025 10:31:55 -0700 Subject: [PATCH 3/4] Code formatting --- dev/src/reference/collection-reference.ts | 9 +- dev/src/reference/document-reference.ts | 9 +- dev/src/telemetry/enabled-trace-util.ts | 5 +- dev/test/gapic_firestore_admin_v1.ts | 76 +++++++------ dev/test/gapic_firestore_v1.ts | 124 +++++++++++++--------- dev/test/gapic_firestore_v1beta1.ts | 124 +++++++++++++--------- 6 files changed, 208 insertions(+), 139 deletions(-) diff --git a/dev/src/reference/collection-reference.ts b/dev/src/reference/collection-reference.ts index 8b065d64b..d91f9e176 100644 --- a/dev/src/reference/collection-reference.ts +++ b/dev/src/reference/collection-reference.ts @@ -191,10 +191,11 @@ export class CollectionReference< }; return this.firestore - .request< - api.IListDocumentsRequest, - api.IDocument[] - >('listDocuments', request, tag) + .request( + 'listDocuments', + request, + tag + ) .then(documents => { // Note that the backend already orders these documents by name, // so we do not need to manually sort them. diff --git a/dev/src/reference/document-reference.ts b/dev/src/reference/document-reference.ts index 52f6d8425..975d9f4e3 100644 --- a/dev/src/reference/document-reference.ts +++ b/dev/src/reference/document-reference.ts @@ -273,10 +273,11 @@ export class DocumentReference< pageSize: Math.pow(2, 16) - 1, }; return this._firestore - .request< - api.IListCollectionIdsRequest, - string[] - >('listCollectionIds', request, tag) + .request( + 'listCollectionIds', + request, + tag + ) .then(collectionIds => { const collections: Array = []; diff --git a/dev/src/telemetry/enabled-trace-util.ts b/dev/src/telemetry/enabled-trace-util.ts index 9b78ee99a..936731f36 100644 --- a/dev/src/telemetry/enabled-trace-util.ts +++ b/dev/src/telemetry/enabled-trace-util.ts @@ -84,8 +84,9 @@ export class EnabledTraceUtil implements TraceUtil { const host = settings.servicePath ?? settings.host ?? 'firestore.googleapis.com'; const port = settings.port ?? FirestoreClient.port; - this.settingsAttributes[`${ATTRIBUTE_SETTINGS_PREFIX}.host`] = - `${host}:${port}`; + this.settingsAttributes[ + `${ATTRIBUTE_SETTINGS_PREFIX}.host` + ] = `${host}:${port}`; if (settings.preferRest !== undefined) { this.settingsAttributes[`${ATTRIBUTE_SETTINGS_PREFIX}.prefer_REST`] = diff --git a/dev/test/gapic_firestore_admin_v1.ts b/dev/test/gapic_firestore_admin_v1.ts index 8bdc602c6..1cd02d31b 100644 --- a/dev/test/gapic_firestore_admin_v1.ts +++ b/dev/test/gapic_firestore_admin_v1.ts @@ -1781,7 +1781,9 @@ describe('v1.FirestoreAdminClient', () => { ['backupSchedule', 'name'] ); request.backupSchedule.name = defaultValue1; - const expectedHeaderRequestParams = `backup_schedule.name=${defaultValue1 ?? ''}`; + const expectedHeaderRequestParams = `backup_schedule.name=${ + defaultValue1 ?? '' + }`; const expectedResponse = generateSampleMessage( new protos.google.firestore.admin.v1.BackupSchedule() ); @@ -1814,7 +1816,9 @@ describe('v1.FirestoreAdminClient', () => { ['backupSchedule', 'name'] ); request.backupSchedule.name = defaultValue1; - const expectedHeaderRequestParams = `backup_schedule.name=${defaultValue1 ?? ''}`; + const expectedHeaderRequestParams = `backup_schedule.name=${ + defaultValue1 ?? '' + }`; const expectedResponse = generateSampleMessage( new protos.google.firestore.admin.v1.BackupSchedule() ); @@ -1862,7 +1866,9 @@ describe('v1.FirestoreAdminClient', () => { ['backupSchedule', 'name'] ); request.backupSchedule.name = defaultValue1; - const expectedHeaderRequestParams = `backup_schedule.name=${defaultValue1 ?? ''}`; + const expectedHeaderRequestParams = `backup_schedule.name=${ + defaultValue1 ?? '' + }`; const expectedError = new Error('expected'); client.innerApiCalls.updateBackupSchedule = stubSimpleCall( undefined, @@ -3207,7 +3213,9 @@ describe('v1.FirestoreAdminClient', () => { ['database', 'name'] ); request.database.name = defaultValue1; - const expectedHeaderRequestParams = `database.name=${defaultValue1 ?? ''}`; + const expectedHeaderRequestParams = `database.name=${ + defaultValue1 ?? '' + }`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -3241,7 +3249,9 @@ describe('v1.FirestoreAdminClient', () => { ['database', 'name'] ); request.database.name = defaultValue1; - const expectedHeaderRequestParams = `database.name=${defaultValue1 ?? ''}`; + const expectedHeaderRequestParams = `database.name=${ + defaultValue1 ?? '' + }`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -3296,7 +3306,9 @@ describe('v1.FirestoreAdminClient', () => { ['database', 'name'] ); request.database.name = defaultValue1; - const expectedHeaderRequestParams = `database.name=${defaultValue1 ?? ''}`; + const expectedHeaderRequestParams = `database.name=${ + defaultValue1 ?? '' + }`; const expectedError = new Error('expected'); client.innerApiCalls.updateDatabase = stubLongRunningCall( undefined, @@ -3328,7 +3340,9 @@ describe('v1.FirestoreAdminClient', () => { ['database', 'name'] ); request.database.name = defaultValue1; - const expectedHeaderRequestParams = `database.name=${defaultValue1 ?? ''}`; + const expectedHeaderRequestParams = `database.name=${ + defaultValue1 ?? '' + }`; const expectedError = new Error('expected'); client.innerApiCalls.updateDatabase = stubLongRunningCall( undefined, @@ -3939,9 +3953,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listIndexes.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -3990,9 +4004,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listIndexes.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -4033,9 +4047,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listIndexes.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -4075,9 +4089,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listIndexes.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -4244,9 +4258,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listFields.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -4295,9 +4309,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listFields.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -4338,9 +4352,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listFields.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -4380,9 +4394,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listFields.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/dev/test/gapic_firestore_v1.ts b/dev/test/gapic_firestore_v1.ts index 0f00db1a6..ab5ba80e9 100644 --- a/dev/test/gapic_firestore_v1.ts +++ b/dev/test/gapic_firestore_v1.ts @@ -482,7 +482,9 @@ describe('v1.FirestoreClient', () => { ['document', 'name'] ); request.document.name = defaultValue1; - const expectedHeaderRequestParams = `document.name=${defaultValue1 ?? ''}`; + const expectedHeaderRequestParams = `document.name=${ + defaultValue1 ?? '' + }`; const expectedResponse = generateSampleMessage( new protos.google.firestore.v1.Document() ); @@ -514,7 +516,9 @@ describe('v1.FirestoreClient', () => { ['document', 'name'] ); request.document.name = defaultValue1; - const expectedHeaderRequestParams = `document.name=${defaultValue1 ?? ''}`; + const expectedHeaderRequestParams = `document.name=${ + defaultValue1 ?? '' + }`; const expectedResponse = generateSampleMessage( new protos.google.firestore.v1.Document() ); @@ -562,7 +566,9 @@ describe('v1.FirestoreClient', () => { ['document', 'name'] ); request.document.name = defaultValue1; - const expectedHeaderRequestParams = `document.name=${defaultValue1 ?? ''}`; + const expectedHeaderRequestParams = `document.name=${ + defaultValue1 ?? '' + }`; const expectedError = new Error('expected'); client.innerApiCalls.updateDocument = stubSimpleCall( undefined, @@ -1264,7 +1270,9 @@ describe('v1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.firestore.v1.Document() ); @@ -1300,7 +1308,9 @@ describe('v1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.firestore.v1.Document() ); @@ -1352,7 +1362,9 @@ describe('v1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.createDocument = stubSimpleCall( undefined, @@ -2095,7 +2107,9 @@ describe('v1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.firestore.v1.Document()), generateSampleMessage(new protos.google.firestore.v1.Document()), @@ -2133,7 +2147,9 @@ describe('v1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.firestore.v1.Document()), generateSampleMessage(new protos.google.firestore.v1.Document()), @@ -2187,7 +2203,9 @@ describe('v1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.listDocuments = stubSimpleCall( undefined, @@ -2223,7 +2241,9 @@ describe('v1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.firestore.v1.Document()), generateSampleMessage(new protos.google.firestore.v1.Document()), @@ -2254,9 +2274,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2279,7 +2299,9 @@ describe('v1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listDocuments.createStream = stubPageStreamingCall(undefined, expectedError); @@ -2305,9 +2327,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2330,7 +2352,9 @@ describe('v1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.firestore.v1.Document()), generateSampleMessage(new protos.google.firestore.v1.Document()), @@ -2353,9 +2377,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2378,7 +2402,9 @@ describe('v1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listDocuments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -2398,9 +2424,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -2564,9 +2590,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2610,9 +2636,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2653,9 +2679,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2693,9 +2719,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -2844,9 +2870,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2890,9 +2916,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2929,9 +2955,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2969,9 +2995,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/dev/test/gapic_firestore_v1beta1.ts b/dev/test/gapic_firestore_v1beta1.ts index 250872cf6..e17e0cad5 100644 --- a/dev/test/gapic_firestore_v1beta1.ts +++ b/dev/test/gapic_firestore_v1beta1.ts @@ -484,7 +484,9 @@ describe('v1beta1.FirestoreClient', () => { ['document', 'name'] ); request.document.name = defaultValue1; - const expectedHeaderRequestParams = `document.name=${defaultValue1 ?? ''}`; + const expectedHeaderRequestParams = `document.name=${ + defaultValue1 ?? '' + }`; const expectedResponse = generateSampleMessage( new protos.google.firestore.v1beta1.Document() ); @@ -516,7 +518,9 @@ describe('v1beta1.FirestoreClient', () => { ['document', 'name'] ); request.document.name = defaultValue1; - const expectedHeaderRequestParams = `document.name=${defaultValue1 ?? ''}`; + const expectedHeaderRequestParams = `document.name=${ + defaultValue1 ?? '' + }`; const expectedResponse = generateSampleMessage( new protos.google.firestore.v1beta1.Document() ); @@ -564,7 +568,9 @@ describe('v1beta1.FirestoreClient', () => { ['document', 'name'] ); request.document.name = defaultValue1; - const expectedHeaderRequestParams = `document.name=${defaultValue1 ?? ''}`; + const expectedHeaderRequestParams = `document.name=${ + defaultValue1 ?? '' + }`; const expectedError = new Error('expected'); client.innerApiCalls.updateDocument = stubSimpleCall( undefined, @@ -1266,7 +1272,9 @@ describe('v1beta1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.firestore.v1beta1.Document() ); @@ -1302,7 +1310,9 @@ describe('v1beta1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedResponse = generateSampleMessage( new protos.google.firestore.v1beta1.Document() ); @@ -1354,7 +1364,9 @@ describe('v1beta1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.createDocument = stubSimpleCall( undefined, @@ -1926,7 +1938,9 @@ describe('v1beta1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.firestore.v1beta1.Document()), generateSampleMessage(new protos.google.firestore.v1beta1.Document()), @@ -1964,7 +1978,9 @@ describe('v1beta1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.firestore.v1beta1.Document()), generateSampleMessage(new protos.google.firestore.v1beta1.Document()), @@ -2018,7 +2034,9 @@ describe('v1beta1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedError = new Error('expected'); client.innerApiCalls.listDocuments = stubSimpleCall( undefined, @@ -2054,7 +2072,9 @@ describe('v1beta1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.firestore.v1beta1.Document()), generateSampleMessage(new protos.google.firestore.v1beta1.Document()), @@ -2088,9 +2108,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2113,7 +2133,9 @@ describe('v1beta1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listDocuments.createStream = stubPageStreamingCall(undefined, expectedError); @@ -2142,9 +2164,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2167,7 +2189,9 @@ describe('v1beta1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedResponse = [ generateSampleMessage(new protos.google.firestore.v1beta1.Document()), generateSampleMessage(new protos.google.firestore.v1beta1.Document()), @@ -2190,9 +2214,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2215,7 +2239,9 @@ describe('v1beta1.FirestoreClient', () => { ['collectionId'] ); request.collectionId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}&collection_id=${defaultValue2 ?? ''}`; + const expectedHeaderRequestParams = `parent=${ + defaultValue1 ?? '' + }&collection_id=${defaultValue2 ?? ''}`; const expectedError = new Error('expected'); client.descriptors.page.listDocuments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -2235,9 +2261,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -2404,9 +2430,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2453,9 +2479,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2496,9 +2522,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2536,9 +2562,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -2687,9 +2713,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2733,9 +2759,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2772,9 +2798,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2812,9 +2838,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); From 4d6ab8342d0d37cb4fc36d30aeeb68c6aa14d2cd Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 18 Feb 2025 17:37:12 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- dev/src/reference/collection-reference.ts | 9 ++- dev/src/reference/document-reference.ts | 9 ++- dev/src/telemetry/enabled-trace-util.ts | 5 +- dev/test/gapic_firestore_admin_v1.ts | 48 +++++++-------- dev/test/gapic_firestore_v1.ts | 72 +++++++++++------------ dev/test/gapic_firestore_v1beta1.ts | 72 +++++++++++------------ 6 files changed, 106 insertions(+), 109 deletions(-) diff --git a/dev/src/reference/collection-reference.ts b/dev/src/reference/collection-reference.ts index d91f9e176..8b065d64b 100644 --- a/dev/src/reference/collection-reference.ts +++ b/dev/src/reference/collection-reference.ts @@ -191,11 +191,10 @@ export class CollectionReference< }; return this.firestore - .request( - 'listDocuments', - request, - tag - ) + .request< + api.IListDocumentsRequest, + api.IDocument[] + >('listDocuments', request, tag) .then(documents => { // Note that the backend already orders these documents by name, // so we do not need to manually sort them. diff --git a/dev/src/reference/document-reference.ts b/dev/src/reference/document-reference.ts index 975d9f4e3..52f6d8425 100644 --- a/dev/src/reference/document-reference.ts +++ b/dev/src/reference/document-reference.ts @@ -273,11 +273,10 @@ export class DocumentReference< pageSize: Math.pow(2, 16) - 1, }; return this._firestore - .request( - 'listCollectionIds', - request, - tag - ) + .request< + api.IListCollectionIdsRequest, + string[] + >('listCollectionIds', request, tag) .then(collectionIds => { const collections: Array = []; diff --git a/dev/src/telemetry/enabled-trace-util.ts b/dev/src/telemetry/enabled-trace-util.ts index 936731f36..9b78ee99a 100644 --- a/dev/src/telemetry/enabled-trace-util.ts +++ b/dev/src/telemetry/enabled-trace-util.ts @@ -84,9 +84,8 @@ export class EnabledTraceUtil implements TraceUtil { const host = settings.servicePath ?? settings.host ?? 'firestore.googleapis.com'; const port = settings.port ?? FirestoreClient.port; - this.settingsAttributes[ - `${ATTRIBUTE_SETTINGS_PREFIX}.host` - ] = `${host}:${port}`; + this.settingsAttributes[`${ATTRIBUTE_SETTINGS_PREFIX}.host`] = + `${host}:${port}`; if (settings.preferRest !== undefined) { this.settingsAttributes[`${ATTRIBUTE_SETTINGS_PREFIX}.prefer_REST`] = diff --git a/dev/test/gapic_firestore_admin_v1.ts b/dev/test/gapic_firestore_admin_v1.ts index 1cd02d31b..8df571fea 100644 --- a/dev/test/gapic_firestore_admin_v1.ts +++ b/dev/test/gapic_firestore_admin_v1.ts @@ -3953,9 +3953,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listIndexes.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -4004,9 +4004,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listIndexes.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -4047,9 +4047,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listIndexes.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -4089,9 +4089,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listIndexes.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); }); @@ -4258,9 +4258,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listFields.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -4309,9 +4309,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listFields.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -4352,9 +4352,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listFields.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -4394,9 +4394,9 @@ describe('v1.FirestoreAdminClient', () => { assert( (client.descriptors.page.listFields.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); }); diff --git a/dev/test/gapic_firestore_v1.ts b/dev/test/gapic_firestore_v1.ts index ab5ba80e9..eda81fb8e 100644 --- a/dev/test/gapic_firestore_v1.ts +++ b/dev/test/gapic_firestore_v1.ts @@ -2274,9 +2274,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2327,9 +2327,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2377,9 +2377,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2424,9 +2424,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); }); @@ -2590,9 +2590,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2636,9 +2636,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2679,9 +2679,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2719,9 +2719,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); }); @@ -2870,9 +2870,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2916,9 +2916,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2955,9 +2955,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2995,9 +2995,9 @@ describe('v1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); }); diff --git a/dev/test/gapic_firestore_v1beta1.ts b/dev/test/gapic_firestore_v1beta1.ts index e17e0cad5..c11cf8a71 100644 --- a/dev/test/gapic_firestore_v1beta1.ts +++ b/dev/test/gapic_firestore_v1beta1.ts @@ -2108,9 +2108,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2164,9 +2164,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2214,9 +2214,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2261,9 +2261,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listDocuments.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); }); @@ -2430,9 +2430,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2479,9 +2479,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2522,9 +2522,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2562,9 +2562,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.partitionQuery.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); }); @@ -2713,9 +2713,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2759,9 +2759,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2798,9 +2798,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2838,9 +2838,9 @@ describe('v1beta1.FirestoreClient', () => { assert( (client.descriptors.page.listCollectionIds.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); });