зеркало из
1
0
Форкнуть 0
This commit is contained in:
manasi 2022-07-15 14:29:32 -07:00
Родитель 5fd1cd79c3
Коммит 0f29fb88e3
3 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -5,6 +5,7 @@
import { setIconOptions } from '@fluentui/react';
import * as Enzyme from 'enzyme';
import * as Adapter from 'enzyme-adapter-react-16';
import { appConfig } from './src/appConfig/appConfig'
// tslint:disable-next-line: no-string-literal
global.Headers = jest.fn();
@ -26,3 +27,9 @@ Object.defineProperty(global, 'Node', {
jest.mock('react-i18next', () => ({
useTranslation: () => ({t: key => key})
}));
jest.mock('./src/appConfig/appConfig', () => ({
...jest.requireActual('./src/appConfig/appConfig'),
appConfig: {
telemetryConnString: 'InstrumentationKey=4e4b375e-0c49-42e3-8a51-20b22ce36181;IngestionEndpoint=https://westus2-2.in.applicationinsights.azure.com/;LiveEndpoint=https://westus2.livediagnostics.monitor.azure.com/'
}}));

Просмотреть файл

@ -1,5 +1,5 @@
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
import { appConfig, AppInsightsConnString } from '../../../appConfig/appConfig';
import { appConfig } from '../../../appConfig/appConfig';
export class AppInsightsClient {
private static instance: ApplicationInsights;
@ -7,7 +7,7 @@ export class AppInsightsClient {
if (!AppInsightsClient.instance) {
const appInsights = new ApplicationInsights({ config: {
autoTrackPageVisitTime: true,
connectionString: appConfig.telemetryConnString ? appConfig.telemetryConnString : AppInsightsConnString.Prod,
connectionString: appConfig.telemetryConnString
} });
appInsights.loadAppInsights();
appInsights.trackEvent({name: `INIT`}, {type: 'init'});

Просмотреть файл

@ -11,11 +11,6 @@ export enum HostMode {
Debug = 'debug'
}
export enum AppInsightsConnString {
Dev = 'InstrumentationKey=4e4b375e-0c49-42e3-8a51-20b22ce36181;IngestionEndpoint=https://westus2-2.in.applicationinsights.azure.com/;LiveEndpoint=https://westus2.livediagnostics.monitor.azure.com/',
Prod = 'InstrumentationKey=7ff6989f-09a7-439b-9492-071d8430f64a;IngestionEndpoint=https://westus2-2.in.applicationinsights.azure.com/;LiveEndpoint=https://westus2.livediagnostics.monitor.azure.com/',
}
export interface AppConfigInterface {
developmentMode: boolean;
hostMode: HostMode;
@ -26,7 +21,7 @@ export interface AppConfigInterface {
};
azureResourceManagementEndpoint?: string;
controllerPort: number;
telemetryConnString: AppInsightsConnString;
telemetryConnString: string;
}
export const appConfig = config as AppConfigInterface;