Skip to content

Commit

Permalink
test: ut
Browse files Browse the repository at this point in the history
  • Loading branch information
yuqizhou77 committed Dec 11, 2024
1 parent a88b6d5 commit f6e2e84
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/vscode-extension/test/handlers/openLinkHandlers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import M365TokenInstance from "../../src/commonlib/m365Login";
import { signedIn, signedOut } from "../../src/commonlib/common/constant";
import { DeveloperPortalHomeLink } from "../../src/constants";
import {
findGitHubSimilarIssue,
openAccountLinkHandler,
openAppManagement,
openAzureAccountHandler,
Expand Down Expand Up @@ -343,4 +344,29 @@ describe("Open link handlers", () => {
);
});
});

describe("findGitHubSimilarIssue", () => {
it("open issues", async () => {
const commandStub = sandbox.stub(vscode.commands, "executeCommand").resolves();
await findGitHubSimilarIssue(["firsterror"]);

chai.assert.isTrue(commandStub.calledOnce);
});

it("do nothing if invalid args", async () => {
const commandStub = sandbox.stub(vscode.commands, "executeCommand").resolves();
const res = await findGitHubSimilarIssue([]);

chai.assert.isFalse(commandStub.calledOnce);
chai.assert.isTrue(res.isOk());
});

it("do nothing if no args", async () => {
const commandStub = sandbox.stub(vscode.commands, "executeCommand").resolves();
const res = await findGitHubSimilarIssue();

chai.assert.isFalse(commandStub.calledOnce);
chai.assert.isTrue(res.isOk());
});
});
});

0 comments on commit f6e2e84

Please sign in to comment.