Skip to content

Commit

Permalink
fix: welcome handler (#12957)
Browse files Browse the repository at this point in the history
* fix: welcome handler
  • Loading branch information
anchenyi authored Dec 23, 2024
1 parent 656e1d3 commit 4da5c3b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/vscode-extension/src/handlers/controlHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ export async function openWelcomeHandler(...args: unknown[]): Promise<Result<unk

export async function selectWalkthrough(...args: unknown[]): Promise<Result<unknown, FxError>> {
const TeamsToolkitOptionLabel = getDefaultString("teamstoolkit.walkthroughs.title");
const BuildNotificationBotWalkthroughArgs = "SideBar";
if (args.length > 0 && args[0] == BuildNotificationBotWalkthroughArgs) {
const data = await vscode.commands.executeCommand(
"workbench.action.openWalkthrough",
getWalkThroughId()
);
return Promise.resolve(ok(data));
}
const BuildingIntelligentAppsLabel = getDefaultString(
"teamstoolkit.walkthroughs.buildIntelligentApps.title"
);
Expand Down
16 changes: 15 additions & 1 deletion packages/vscode-extension/test/handlers/controlHandlers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ describe("Control Handlers", () => {
);
});

it("opens normal walkthrough -SideBar", async () => {
sandbox.stub(featureFlagManager, "getBooleanValue").returns(false);
sandbox.stub(manifestUtils, "readAppManifest").resolves(ok({} as TeamsAppManifest));
sandbox.stub(manifestUtils, "getCapabilities").returns(["bot"]);
const executeCommands = sandbox.stub(vscode.commands, "executeCommand");
const sendTelemetryEvent = sandbox.stub(ExtTelemetry, "sendTelemetryEvent");
await openWelcomeHandler("SideBar");
sandbox.assert.calledOnceWithExactly(
executeCommands,
"workbench.action.openWalkthrough",
"TeamsDevApp.ms-teams-vscode-extension#teamsToolkitGetStarted"
);
});

it("opens walkthrough with chat", async () => {
sandbox.stub(featureFlagManager, "getBooleanValue").returns(true);
sandbox.stub(manifestUtils, "readAppManifest").resolves(ok({} as TeamsAppManifest));
Expand All @@ -78,7 +92,7 @@ describe("Control Handlers", () => {
const executeCommands = sandbox.stub(vscode.commands, "executeCommand");
const sendTelemetryEvent = sandbox.stub(ExtTelemetry, "sendTelemetryEvent");

await openWelcomeHandler();
await openWelcomeHandler("invalidArgs");

sandbox.assert.calledOnceWithExactly(
executeCommands,
Expand Down

0 comments on commit 4da5c3b

Please sign in to comment.