Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Karlie-777 committed Jun 23, 2024
1 parent 7cab4e0 commit 1d84dd0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
12 changes: 6 additions & 6 deletions AISKU/Tests/Unit/src/applicationinsights.e2e.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ export class ApplicationInsightsTests extends AITestClass {
});

this.testCase({
name: "CfgSync DynamicConfigTests: Offline Support can be added and initialized with endpoint url",
name: "Init Promise: Offline Support can be added and initialized with endpoint url",
useFakeTimers: true,
test: () => {
this.clock.tick(1);
Expand Down Expand Up @@ -540,13 +540,13 @@ export class ApplicationInsightsTests extends AITestClass {
if (ai && ai["dependencies"]) {
ai["dependencies"].teardown();
}
offlineChannel.teardown();
//offlineChannel.teardown();

}
});

this.testCase({
name: "CfgSync DynamicConfigTests: Offline Support can be added and initialized with channels",
name: "Init Promise: Offline Support can be added and initialized with channels",
useFakeTimers: true,
test: () => {
this.clock.tick(1);
Expand Down Expand Up @@ -578,7 +578,6 @@ export class ApplicationInsightsTests extends AITestClass {
if (ai && ai["dependencies"]) {
ai["dependencies"].teardown();
}
offlineChannel.teardown();

}
});
Expand All @@ -590,7 +589,7 @@ export class ApplicationInsightsTests extends AITestClass {
this.clock.tick(1);
let offlineChannel = new OfflineChannel();
let config = {
instrumentationKey: "testIKey",
connectionString: "InstrumentationKey=testIKey",
extensionConfig:{
["AppInsightsCfgSyncPlugin"]: {
cfgUrl: ""
Expand All @@ -608,13 +607,14 @@ export class ApplicationInsightsTests extends AITestClass {
Assert.equal(sendChannel.plugin.isInitialized(), true, "sender is initialized");
Assert.equal(offlineChannelPlugin.isInitialized(), true, "offline channel is initialized");
let urlConfig = offlineChannelPlugin["_getDbgPlgTargets"]()[0];

this.clock.tick(1);
Assert.ok(urlConfig, "offline url config is initialized");

ai.unload(false);
if (ai && ai["dependencies"]) {
ai["dependencies"].teardown();
}
offlineChannel.teardown();
}
});

Expand Down
7 changes: 5 additions & 2 deletions channels/offline-channel-js/src/OfflineChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,11 @@ export class OfflineChannel extends BaseTelemetryPlugin implements IChannelContr
}

}
let promise = _urlCfg.batchHandler.sendNextBatch(callback, false, _senderInst);
_queueStorageEvent("sendNextBatch", promise);
if (_urlCfg && _urlCfg.batchHandler) {
let promise = _urlCfg.batchHandler.sendNextBatch(callback, false, _senderInst);
_queueStorageEvent("sendNextBatch", promise);
}

}

} else {
Expand Down

0 comments on commit 1d84dd0

Please sign in to comment.