Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Karlie-777 committed Sep 30, 2024
1 parent ed8632a commit 0825b31
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,25 @@ export class ApplicationInsightsCoreTests extends AITestClass {
}
});

this.testCase({
name: "ApplicationInsightsCore: PerfMgr should be created as expected",
test: () => {
let channelPlugin = new TestChannelPlugin();
const appInsightsCore = new AppInsightsCore();
appInsightsCore.initialize(
{
instrumentationKey: "testIkey",
channels: [[channelPlugin]],
enablePerfMgr: true
} as IConfiguration,

[]);
let perfMgr = appInsightsCore.getPerfMgr();
Assert.ok(perfMgr, "perfMgr should be created without customized createPerfMgr function");
}
});



this.testCase({
name: "ApplicationInsightsCore: Initialization initializes setNextPlugin",
Expand Down
4 changes: 3 additions & 1 deletion shared/AppInsightsCore/src/JavaScriptSDK/AppInsightsCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,9 @@ export class AppInsightsCore<CfgType extends IConfiguration = IConfiguration> im
let enablePerfMgr = details.cfg.enablePerfMgr;
if (enablePerfMgr) {
let createPerfMgr = details.cfg.createPerfMgr;
if (prevCfgPerfMgr !== createPerfMgr) {
// for preCfgPerfMgr = createPerfMgr = null
// initial createPerfMgr function should be _createPerfManager
if ((prevCfgPerfMgr !== createPerfMgr) || !prevCfgPerfMgr) {
if (!createPerfMgr) {
createPerfMgr = _createPerfManager;
}
Expand Down

0 comments on commit 0825b31

Please sign in to comment.