Skip to content

Commit 50ab9ad

Browse files
committed
Cleaned up var naming
1 parent 16fdf3e commit 50ab9ad

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

packages/telemetry/src/logging/installation-id-provider.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@ import { _FirebaseInstallationsInternal } from '@firebase/installations';
2020
import { expect } from 'chai';
2121

2222
describe('InstallationIdProvider', () => {
23-
it('should cache the FID after the first call', async () => {
23+
it('should cache the installation id after the first call', async () => {
2424
let callCount = 0;
2525
const mockInstallations = {
2626
getId: async () => {
2727
callCount++;
28-
return 'fid-123';
28+
return 'iid-123';
2929
}
3030
} as unknown as _FirebaseInstallationsInternal;
3131

3232
const provider = new InstallationIdProvider(mockInstallations);
3333

3434
const attr1 = await provider.getAttribute();
35-
expect(attr1).to.deep.equal(['user.id', 'fid-123']);
35+
expect(attr1).to.deep.equal(['user.id', 'iid-123']);
3636
expect(callCount).to.equal(1);
3737

3838
const attr2 = await provider.getAttribute();
39-
expect(attr2).to.deep.equal(['user.id', 'fid-123']);
39+
expect(attr2).to.deep.equal(['user.id', 'iid-123']);
4040
expect(callCount).to.equal(1); // Should still be 1
4141
});
4242

43-
it('should not cache if FID is null', async () => {
43+
it('should not cache if installation id is null', async () => {
4444
let callCount = 0;
4545
let returnValue: string | null = null;
4646
const mockInstallations = {
@@ -56,14 +56,14 @@ describe('InstallationIdProvider', () => {
5656
expect(attr1).to.be.null;
5757
expect(callCount).to.equal(1);
5858

59-
returnValue = 'fid-456';
59+
returnValue = 'iid-456';
6060
const attr2 = await provider.getAttribute();
61-
expect(attr2).to.deep.equal(['user.id', 'fid-456']);
61+
expect(attr2).to.deep.equal(['user.id', 'iid-456']);
6262
expect(callCount).to.equal(2);
6363

6464
// Should cache now
6565
const attr3 = await provider.getAttribute();
66-
expect(attr3).to.deep.equal(['user.id', 'fid-456']);
66+
expect(attr3).to.deep.equal(['user.id', 'iid-456']);
6767
expect(callCount).to.equal(2);
6868
});
6969
});

packages/telemetry/src/logging/installation-id-provider.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,26 @@ import { DynamicLogAttributeProvider, LogEntryAttribute } from '../types';
1919
import { _FirebaseInstallationsInternal } from '@firebase/installations';
2020

2121
/**
22-
* An implementation of DynamicHeaderProvider that can be used to provide App Check token headers.
22+
* Allows logging to include the client's installation ID.
2323
*
2424
* @internal
2525
*/
2626
export class InstallationIdProvider implements DynamicLogAttributeProvider {
27-
private _fid: string | undefined;
27+
private _iid: string | undefined;
2828

2929
constructor(private installationsProvider: _FirebaseInstallationsInternal) {}
3030

3131
async getAttribute(): Promise<LogEntryAttribute | null> {
32-
if (this._fid) {
33-
return ['user.id', this._fid];
32+
if (this._iid) {
33+
return ['user.id', this._iid];
3434
}
3535

36-
const fid = await this.installationsProvider.getId();
37-
if (!fid) {
36+
const iid = await this.installationsProvider.getId();
37+
if (!iid) {
3838
return null;
3939
}
4040

41-
this._fid = fid;
42-
return ['user.id', fid];
41+
this._iid = iid;
42+
return ['user.id', iid];
4343
}
4444
}

0 commit comments

Comments
 (0)