From 201f4e20c5beee059156a5599a4a859b7b7f69ab Mon Sep 17 00:00:00 2001 From: Thomas Norling Date: Fri, 28 Jul 2023 18:57:49 +0000 Subject: [PATCH] fix formatting from latest pull --- lib/msal-browser/src/config/Configuration.ts | 4 +- .../src/telemetry/BrowserPerformanceClient.ts | 15 +- .../test/app/PublicClientApplication.spec.ts | 2 +- .../BrowserPerformanceClient.spec.ts | 12 +- lib/msal-browser/test/utils/TelemetryUtils.ts | 16 +- .../src/client/AuthorizationCodeClient.ts | 1 - .../performance/IPerformanceClient.ts | 23 +- .../performance/PerformanceClient.ts | 26 +- .../telemetry/performance/PerformanceEvent.ts | 464 +++++++++--------- .../performance/StubPerformanceClient.ts | 50 +- .../client/AuthorizationCodeClient.spec.ts | 25 +- .../test/client/RefreshTokenClient.spec.ts | 25 +- 12 files changed, 341 insertions(+), 322 deletions(-) diff --git a/lib/msal-browser/src/config/Configuration.ts b/lib/msal-browser/src/config/Configuration.ts index 572a012762..54685409f3 100644 --- a/lib/msal-browser/src/config/Configuration.ts +++ b/lib/msal-browser/src/config/Configuration.ts @@ -341,9 +341,9 @@ export function buildConfiguration( version, { appName: Constants.EMPTY_STRING, - appVersion: Constants.EMPTY_STRING + appVersion: Constants.EMPTY_STRING, } - ) + ), }; // Throw an error if user has set OIDCOptions without being in OIDC protocol mode diff --git a/lib/msal-browser/src/telemetry/BrowserPerformanceClient.ts b/lib/msal-browser/src/telemetry/BrowserPerformanceClient.ts index 5d857a23c3..01ff57cfcc 100644 --- a/lib/msal-browser/src/telemetry/BrowserPerformanceClient.ts +++ b/lib/msal-browser/src/telemetry/BrowserPerformanceClient.ts @@ -40,13 +40,18 @@ export class BrowserPerformanceClient super( configuration.auth.clientId, configuration.auth.authority || `${Constants.DEFAULT_AUTHORITY}`, - logger || new Logger( - configuration.system?.loggerOptions || {}, - libName, - libVersion), + logger || + new Logger( + configuration.system?.loggerOptions || {}, + libName, + libVersion + ), libName, libVersion, - configuration.telemetry?.application || { appName: '', appVersion: '' }, + configuration.telemetry?.application || { + appName: "", + appVersion: "", + }, intFields ); this.browserCrypto = new BrowserCrypto(this.logger); diff --git a/lib/msal-browser/test/app/PublicClientApplication.spec.ts b/lib/msal-browser/test/app/PublicClientApplication.spec.ts index 9b4739da59..680c352ca9 100644 --- a/lib/msal-browser/test/app/PublicClientApplication.spec.ts +++ b/lib/msal-browser/test/app/PublicClientApplication.spec.ts @@ -1012,7 +1012,7 @@ describe("PublicClientApplication.ts Class Unit Tests", () => { }, telemetry: { client: new BrowserPerformanceClient(testAppConfig), - } + }, }); const callbackId = pca.addPerformanceCallback((events) => { diff --git a/lib/msal-browser/test/telemetry/BrowserPerformanceClient.spec.ts b/lib/msal-browser/test/telemetry/BrowserPerformanceClient.spec.ts index 76ab9912bf..328d85f540 100644 --- a/lib/msal-browser/test/telemetry/BrowserPerformanceClient.spec.ts +++ b/lib/msal-browser/test/telemetry/BrowserPerformanceClient.spec.ts @@ -1,6 +1,4 @@ -import { - PerformanceEvents, -} from "@azure/msal-common"; +import { PerformanceEvents } from "@azure/msal-common"; import { BrowserPerformanceClient } from "../../src/telemetry/BrowserPerformanceClient"; import { TEST_CONFIG } from "../utils/StringConstants"; @@ -31,9 +29,7 @@ describe("BrowserPerformanceClient.ts", () => { }); it("sets pre-queue time", () => { - const browserPerfClient = new BrowserPerformanceClient( - testAppConfig - ); + const browserPerfClient = new BrowserPerformanceClient(testAppConfig); const eventName = PerformanceEvents.AcquireTokenSilent; const correlationId = "test-correlation-id"; const perfTimeNow = 1234567890; @@ -100,9 +96,7 @@ describe("BrowserPerformanceClient.ts", () => { }); it("supportsBrowserPerformanceNow returns false if window.performance not present", () => { - const browserPerfClient = new BrowserPerformanceClient( - testAppConfig - ); + const browserPerfClient = new BrowserPerformanceClient(testAppConfig); // @ts-ignore jest.spyOn(window, "performance", "get").mockReturnValue(undefined); diff --git a/lib/msal-browser/test/utils/TelemetryUtils.ts b/lib/msal-browser/test/utils/TelemetryUtils.ts index f1edd6684b..6d88f3b363 100644 --- a/lib/msal-browser/test/utils/TelemetryUtils.ts +++ b/lib/msal-browser/test/utils/TelemetryUtils.ts @@ -3,18 +3,14 @@ * Licensed under the MIT License. */ -import { - IPerformanceClient, -} from "@azure/msal-common"; +import { IPerformanceClient } from "@azure/msal-common"; import { BrowserPerformanceClient } from "../../src/telemetry/BrowserPerformanceClient"; import { TEST_CONFIG } from "./StringConstants"; export function getDefaultPerformanceClient(): IPerformanceClient { - return new BrowserPerformanceClient( - { - auth: { - clientId: TEST_CONFIG.MSAL_CLIENT_ID, - }, - } - ); + return new BrowserPerformanceClient({ + auth: { + clientId: TEST_CONFIG.MSAL_CLIENT_ID, + }, + }); } diff --git a/lib/msal-common/src/client/AuthorizationCodeClient.ts b/lib/msal-common/src/client/AuthorizationCodeClient.ts index 8b93b3c535..8af4cde266 100644 --- a/lib/msal-common/src/client/AuthorizationCodeClient.ts +++ b/lib/msal-common/src/client/AuthorizationCodeClient.ts @@ -71,7 +71,6 @@ export class AuthorizationCodeClient extends BaseClient { async getAuthCodeUrl( request: CommonAuthorizationUrlRequest ): Promise { - this.performanceClient?.addQueueMeasurement( PerformanceEvents.GetAuthCodeUrl, request.correlationId diff --git a/lib/msal-common/src/telemetry/performance/IPerformanceClient.ts b/lib/msal-common/src/telemetry/performance/IPerformanceClient.ts index d537af8d9d..c68a2524da 100644 --- a/lib/msal-common/src/telemetry/performance/IPerformanceClient.ts +++ b/lib/msal-common/src/telemetry/performance/IPerformanceClient.ts @@ -3,21 +3,16 @@ * Licensed under the MIT License. */ -import { - PerformanceEvent, - PerformanceEvents -} from "./PerformanceEvent"; +import { PerformanceEvent, PerformanceEvents } from "./PerformanceEvent"; import { IPerformanceMeasurement } from "./IPerformanceMeasurement"; export type PerformanceCallbackFunction = (events: PerformanceEvent[]) => void; export type InProgressPerformanceEvent = { - end: ( - event?: Partial - ) => PerformanceEvent | null; + end: (event?: Partial) => PerformanceEvent | null; discard: () => void; - add: (fields: { [key: string]: {} | undefined; }) => void; - increment: (fields: { [key: string]: number | undefined; }) => void; + add: (fields: { [key: string]: {} | undefined }) => void; + increment: (fields: { [key: string]: number | undefined }) => void; event: PerformanceEvent; measurement: IPerformanceMeasurement; }; @@ -29,8 +24,14 @@ export interface IPerformanceClient { ): InProgressPerformanceEvent; endMeasurement(event: PerformanceEvent): PerformanceEvent | null; discardMeasurements(correlationId: string): void; - addFields(fields: { [key: string]: {} | undefined }, correlationId: string): void; - incrementFields(fields: { [key: string]: number | undefined }, correlationId: string): void; + addFields( + fields: { [key: string]: {} | undefined }, + correlationId: string + ): void; + incrementFields( + fields: { [key: string]: number | undefined }, + correlationId: string + ): void; removePerformanceCallback(callbackId: string): boolean; addPerformanceCallback(callback: PerformanceCallbackFunction): string; emitEvents(events: PerformanceEvent[], correlationId: string): void; diff --git a/lib/msal-common/src/telemetry/performance/PerformanceClient.ts b/lib/msal-common/src/telemetry/performance/PerformanceClient.ts index 60f9893477..0604412ae5 100644 --- a/lib/msal-common/src/telemetry/performance/PerformanceClient.ts +++ b/lib/msal-common/src/telemetry/performance/PerformanceClient.ts @@ -16,7 +16,7 @@ import { IntFields, PerformanceEvent, PerformanceEvents, - PerformanceEventStatus + PerformanceEventStatus, } from "./PerformanceEvent"; export interface PreQueueEvent { @@ -316,15 +316,15 @@ export abstract class PerformanceClient implements IPerformanceClient { discard: () => { return this.discardMeasurements(inProgressEvent.correlationId); }, - add: (fields: { [key: string]: {} | undefined; }) => { - return this.addFields( + add: (fields: { [key: string]: {} | undefined }) => { + return this.addFields(fields, inProgressEvent.correlationId); + }, + increment: (fields: { [key: string]: number | undefined }) => { + return this.incrementFields( fields, inProgressEvent.correlationId ); }, - increment: (fields: { [key: string]: number | undefined; }) => { - return this.incrementFields(fields, inProgressEvent.correlationId); - }, measurement: performanceMeasurement, event: inProgressEvent, }; @@ -421,7 +421,10 @@ export abstract class PerformanceClient implements IPerformanceClient { * @param fields * @param correlationId */ - addFields(fields: { [key: string]: {} | undefined; }, correlationId: string): void { + addFields( + fields: { [key: string]: {} | undefined }, + correlationId: string + ): void { this.logger.trace("PerformanceClient: Updating static fields"); const event = this.eventsByCorrelationId.get(correlationId); if (event) { @@ -442,7 +445,10 @@ export abstract class PerformanceClient implements IPerformanceClient { * @param fields {string[]} * @param correlationId {string} correlation identifier */ - incrementFields(fields: { [key: string]: number | undefined; }, correlationId: string): void { + incrementFields( + fields: { [key: string]: number | undefined }, + correlationId: string + ): void { this.logger.trace("PerformanceClient: Updating counters"); const event = this.eventsByCorrelationId.get(correlationId); if (event) { @@ -622,9 +628,7 @@ export abstract class PerformanceClient implements IPerformanceClient { * @param {PerformanceEvent} event performance event to update. * @param {Set} intFields integral fields. */ - private truncateIntegralFields( - event: PerformanceEvent - ): void { + private truncateIntegralFields(event: PerformanceEvent): void { this.intFields.forEach((key) => { if (key in event && typeof event[key] === "number") { event[key] = Math.floor(event[key]); diff --git a/lib/msal-common/src/telemetry/performance/PerformanceEvent.ts b/lib/msal-common/src/telemetry/performance/PerformanceEvent.ts index e2e2dbae2f..4d8c61e95a 100644 --- a/lib/msal-common/src/telemetry/performance/PerformanceEvent.ts +++ b/lib/msal-common/src/telemetry/performance/PerformanceEvent.ts @@ -257,7 +257,7 @@ export const PerformanceEvents = { NativeMessageHandlerHandshake: "nativeMessageHandlerHandshake", - NativeGenerateAuthResult: "nativeGenerateAuthResult" + NativeGenerateAuthResult: "nativeGenerateAuthResult", } as const; export type PerformanceEvents = (typeof PerformanceEvents)[keyof typeof PerformanceEvents]; @@ -288,237 +288,237 @@ export type SubMeasurement = { * @typedef {PerformanceEvent} */ export type PerformanceEvent = { - /** - * Unique id for the event - * - * @type {string} - */ - eventId: string; - - /** - * State of the perforance measure. - * - * @type {PerformanceEventStatus} - */ - status: PerformanceEventStatus; - - /** - * Login authority used for the request - * - * @type {string} - */ - authority: string; - - /** - * Client id for the application - * - * @type {string} - */ - clientId: string; - - /** - * Correlation ID used for the request - * - * @type {string} - */ - correlationId: string; - - /** - * End-to-end duration in milliseconds. - * @date 3/22/2022 - 3:40:05 PM - * - * @type {number} - */ - durationMs?: number; - - /** - * Visibility of the page when the event completed. - * Read from: https://developer.mozilla.org/docs/Web/API/Page_Visibility_API - * - * @type {?(string | null)} - */ - endPageVisibility?: string | null; - - /** - * Whether the result was retrieved from the cache. - * - * @type {(boolean | null)} - */ - fromCache?: boolean | null; - - /** - * Event name (usually in the form of classNameFunctionName) - * - * @type {string} - */ - name: string; - - /** - * Visibility of the page when the event completed. - * Read from: https://developer.mozilla.org/docs/Web/API/Page_Visibility_API - * - * @type {?(string | null)} - */ - startPageVisibility?: string | null; - - /** - * Unix millisecond timestamp when the event was initiated. - * - * @type {number} - */ - startTimeMs: number; - - /** - * Whether or the operation completed successfully. - * - * @type {(boolean | null)} - */ - success?: boolean | null; - - /** - * Add specific error code in case of failure - * - * @type {string} - */ - errorCode?: string; - - /** - * Add specific sub error code in case of failure - * - * @type {string} - */ - subErrorCode?: string; - - /** - * Name of the library used for the operation. - * - * @type {string} - */ - libraryName: string; - - /** - * Version of the library used for the operation. - * - * @type {string} - */ - libraryVersion: string; - - /** - * Whether the response is from a native component (e.g., WAM) - * - * @type {?boolean} - */ - isNativeBroker?: boolean; - - /** - * Request ID returned from the response - * - * @type {?string} - */ - requestId?: string; - - /** - * Cache lookup policy - * - * @type {?number} - */ - cacheLookupPolicy?: number | undefined; - - /** - * Amount of time spent in the JS queue in milliseconds. - * - * @type {?number} - */ - queuedTimeMs?: number; - - /** - * Sub-measurements for internal use. To be deleted before flushing. - */ - incompleteSubMeasurements?: Map; - - visibilityChangeCount?: number; - incompleteSubsCount?: number; - /** - * Amount of times queued in the JS event queue. - * - * @type {?number} - */ - queuedCount?: number; - /** - * Amount of manually completed queue events. - * - * @type {?number} - */ - queuedManuallyCompletedCount?: number; - - /** - * Size of the id token - * - * @type {number} - */ - idTokenSize?: number; - - /** - * - * Size of the access token - * - * @type {number} - */ - - accessTokenSize?: number; - - /** - * - * Size of the refresh token - * - * @type {number} - */ - - refreshTokenSize?: number | undefined; - - /** - * Application name as specified by the app. - * - * @type {?string} - */ - appName?: string; - - /** - * Application version as specified by the app. - * - * @type {?string} - */ - appVersion?: string; - - /** - * The following are fields that may be emitted in native broker scenarios - */ - extensionId?: string; - extensionVersion?: string; - matsBrokerVersion?: string; - matsAccountJoinOnStart?: string; - matsAccountJoinOnEnd?: string; - matsDeviceJoin?: string; - matsPromptBehavior?: string; - matsApiErrorCode?: number; - matsUiVisible?: boolean; - matsSilentCode?: number; - matsSilentBiSubCode?: number; - matsSilentMessage?: string; - matsSilentStatus?: number; - matsHttpStatus?: number; - matsHttpEventCount?: number; - httpVerToken?: string; - httpVerAuthority?: string; - - /** - * Native broker fields - */ - allowNativeBroker?: boolean; - extensionInstalled?: boolean; - extensionHandshakeTimeoutMs?: number; - extensionHandshakeTimedOut?: boolean; - }; + /** + * Unique id for the event + * + * @type {string} + */ + eventId: string; + + /** + * State of the perforance measure. + * + * @type {PerformanceEventStatus} + */ + status: PerformanceEventStatus; + + /** + * Login authority used for the request + * + * @type {string} + */ + authority: string; + + /** + * Client id for the application + * + * @type {string} + */ + clientId: string; + + /** + * Correlation ID used for the request + * + * @type {string} + */ + correlationId: string; + + /** + * End-to-end duration in milliseconds. + * @date 3/22/2022 - 3:40:05 PM + * + * @type {number} + */ + durationMs?: number; + + /** + * Visibility of the page when the event completed. + * Read from: https://developer.mozilla.org/docs/Web/API/Page_Visibility_API + * + * @type {?(string | null)} + */ + endPageVisibility?: string | null; + + /** + * Whether the result was retrieved from the cache. + * + * @type {(boolean | null)} + */ + fromCache?: boolean | null; + + /** + * Event name (usually in the form of classNameFunctionName) + * + * @type {string} + */ + name: string; + + /** + * Visibility of the page when the event completed. + * Read from: https://developer.mozilla.org/docs/Web/API/Page_Visibility_API + * + * @type {?(string | null)} + */ + startPageVisibility?: string | null; + + /** + * Unix millisecond timestamp when the event was initiated. + * + * @type {number} + */ + startTimeMs: number; + + /** + * Whether or the operation completed successfully. + * + * @type {(boolean | null)} + */ + success?: boolean | null; + + /** + * Add specific error code in case of failure + * + * @type {string} + */ + errorCode?: string; + + /** + * Add specific sub error code in case of failure + * + * @type {string} + */ + subErrorCode?: string; + + /** + * Name of the library used for the operation. + * + * @type {string} + */ + libraryName: string; + + /** + * Version of the library used for the operation. + * + * @type {string} + */ + libraryVersion: string; + + /** + * Whether the response is from a native component (e.g., WAM) + * + * @type {?boolean} + */ + isNativeBroker?: boolean; + + /** + * Request ID returned from the response + * + * @type {?string} + */ + requestId?: string; + + /** + * Cache lookup policy + * + * @type {?number} + */ + cacheLookupPolicy?: number | undefined; + + /** + * Amount of time spent in the JS queue in milliseconds. + * + * @type {?number} + */ + queuedTimeMs?: number; + + /** + * Sub-measurements for internal use. To be deleted before flushing. + */ + incompleteSubMeasurements?: Map; + + visibilityChangeCount?: number; + incompleteSubsCount?: number; + /** + * Amount of times queued in the JS event queue. + * + * @type {?number} + */ + queuedCount?: number; + /** + * Amount of manually completed queue events. + * + * @type {?number} + */ + queuedManuallyCompletedCount?: number; + + /** + * Size of the id token + * + * @type {number} + */ + idTokenSize?: number; + + /** + * + * Size of the access token + * + * @type {number} + */ + + accessTokenSize?: number; + + /** + * + * Size of the refresh token + * + * @type {number} + */ + + refreshTokenSize?: number | undefined; + + /** + * Application name as specified by the app. + * + * @type {?string} + */ + appName?: string; + + /** + * Application version as specified by the app. + * + * @type {?string} + */ + appVersion?: string; + + /** + * The following are fields that may be emitted in native broker scenarios + */ + extensionId?: string; + extensionVersion?: string; + matsBrokerVersion?: string; + matsAccountJoinOnStart?: string; + matsAccountJoinOnEnd?: string; + matsDeviceJoin?: string; + matsPromptBehavior?: string; + matsApiErrorCode?: number; + matsUiVisible?: boolean; + matsSilentCode?: number; + matsSilentBiSubCode?: number; + matsSilentMessage?: string; + matsSilentStatus?: number; + matsHttpStatus?: number; + matsHttpEventCount?: number; + httpVerToken?: string; + httpVerAuthority?: string; + + /** + * Native broker fields + */ + allowNativeBroker?: boolean; + extensionInstalled?: boolean; + extensionHandshakeTimeoutMs?: number; + extensionHandshakeTimedOut?: boolean; +}; export const IntFields: ReadonlySet = new Set([ "accessTokenSize", diff --git a/lib/msal-common/src/telemetry/performance/StubPerformanceClient.ts b/lib/msal-common/src/telemetry/performance/StubPerformanceClient.ts index ba07548e14..77dabd65e9 100644 --- a/lib/msal-common/src/telemetry/performance/StubPerformanceClient.ts +++ b/lib/msal-common/src/telemetry/performance/StubPerformanceClient.ts @@ -20,8 +20,6 @@ export class StubPerformanceMeasurement implements IPerformanceMeasurement { } } -const stubPerformanceMeasurement = new StubPerformanceMeasurement(); - export class StubPerformanceClient extends PerformanceClient implements IPerformanceClient @@ -45,36 +43,36 @@ export class StubPerformanceClient setPreQueueTime(): void { return; } - - endMeasurement(): PerformanceEvent | null { - return null; + + endMeasurement(): PerformanceEvent | null { + return null; } - - discardMeasurements(): void { - return; + + discardMeasurements(): void { + return; } - - removePerformanceCallback(): boolean { - return true; + + removePerformanceCallback(): boolean { + return true; } - - addPerformanceCallback(): string { - return ''; + + addPerformanceCallback(): string { + return ""; } - - emitEvents(): void { - return; + + emitEvents(): void { + return; } - - addFields(): void { - return; + + addFields(): void { + return; } - - incrementFields(): void { - return; + + incrementFields(): void { + return; } - - cacheEventByCorrelationId(): void { - return; + + cacheEventByCorrelationId(): void { + return; } } diff --git a/lib/msal-common/test/client/AuthorizationCodeClient.spec.ts b/lib/msal-common/test/client/AuthorizationCodeClient.spec.ts index e50c6c70c1..e9eb32e6e7 100644 --- a/lib/msal-common/test/client/AuthorizationCodeClient.spec.ts +++ b/lib/msal-common/test/client/AuthorizationCodeClient.spec.ts @@ -3292,10 +3292,14 @@ describe("AuthorizationCodeClient unit tests", () => { }; performanceClient.startMeasurement.mockImplementation(() => { return { - add: (fields: { [key: string]: {} | undefined; }) => performanceClient.addFields(fields, TEST_CONFIG.CORRELATION_ID), + add: (fields: { [key: string]: {} | undefined }) => + performanceClient.addFields( + fields, + TEST_CONFIG.CORRELATION_ID + ), increment: jest.fn(), end: jest.fn(), - } + }; }); const client = new AuthorizationCodeClient( config, @@ -3319,9 +3323,12 @@ describe("AuthorizationCodeClient unit tests", () => { nonce: idTokenClaims.nonce, }); - expect(performanceClient.addFields).toBeCalledWith({ - httpVerAuthority: "xMsHttpVer" - }, TEST_CONFIG.CORRELATION_ID); + expect(performanceClient.addFields).toBeCalledWith( + { + httpVerAuthority: "xMsHttpVer", + }, + TEST_CONFIG.CORRELATION_ID + ); }); it("does not add http version to the measurement when not received in server response", async () => { @@ -3373,10 +3380,14 @@ describe("AuthorizationCodeClient unit tests", () => { }; performanceClient.startMeasurement.mockImplementation(() => { return { - add: (fields: { [key: string]: {} | undefined; }) => performanceClient.addFields(fields, TEST_CONFIG.CORRELATION_ID), + add: (fields: { [key: string]: {} | undefined }) => + performanceClient.addFields( + fields, + TEST_CONFIG.CORRELATION_ID + ), increment: jest.fn(), end: jest.fn(), - } + }; }); const client = new AuthorizationCodeClient( config, diff --git a/lib/msal-common/test/client/RefreshTokenClient.spec.ts b/lib/msal-common/test/client/RefreshTokenClient.spec.ts index e7d6615c9d..3ca066c614 100644 --- a/lib/msal-common/test/client/RefreshTokenClient.spec.ts +++ b/lib/msal-common/test/client/RefreshTokenClient.spec.ts @@ -948,10 +948,14 @@ describe("RefreshTokenClient unit tests", () => { }; performanceClient.startMeasurement.mockImplementation(() => { return { - add: (fields: { [key: string]: {} | undefined; }) => performanceClient.addFields(fields, TEST_CONFIG.CORRELATION_ID), + add: (fields: { [key: string]: {} | undefined }) => + performanceClient.addFields( + fields, + TEST_CONFIG.CORRELATION_ID + ), increment: jest.fn(), end: jest.fn(), - } + }; }); const client = new RefreshTokenClient(config, performanceClient); const refreshTokenRequest: CommonRefreshTokenRequest = { @@ -966,9 +970,12 @@ describe("RefreshTokenClient unit tests", () => { await client.acquireToken(refreshTokenRequest); expect(performanceClient.addFields).toBeCalledTimes(2); - expect(performanceClient.addFields).toBeCalledWith({ - httpVerToken: "xMsHttpVer" - }, TEST_CONFIG.CORRELATION_ID); + expect(performanceClient.addFields).toBeCalledWith( + { + httpVerToken: "xMsHttpVer", + }, + TEST_CONFIG.CORRELATION_ID + ); }); it("does not add http version to the measurement when not received in server response", async () => { @@ -992,10 +999,14 @@ describe("RefreshTokenClient unit tests", () => { }; performanceClient.startMeasurement.mockImplementation(() => { return { - add: (fields: { [key: string]: {} | undefined; }) => performanceClient.addFields(fields, TEST_CONFIG.CORRELATION_ID), + add: (fields: { [key: string]: {} | undefined }) => + performanceClient.addFields( + fields, + TEST_CONFIG.CORRELATION_ID + ), increment: jest.fn(), end: jest.fn(), - } + }; }); const client = new RefreshTokenClient(config, performanceClient); const refreshTokenRequest: CommonRefreshTokenRequest = {