Skip to content

Commit

Permalink
fix: ut
Browse files Browse the repository at this point in the history
  • Loading branch information
jayzhang committed Feb 17, 2025
1 parent 7571161 commit 2838a59
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/fx-core/tests/ui/qm.visitor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ describe("Question Model - Visitor Test", () => {
assert.isTrue(res.isOk() && res.value.type === "skip");
assert.isTrue(stub.calledOnce);
});
it("skip single select will trigger onDidSelection", async () => {
it("skip single select will trigger onDidSelection in non-interactive mode", async () => {
const question: SingleSelectQuestion = {
type: "singleSelect",
name: "test",
Expand All @@ -969,6 +969,23 @@ describe("Question Model - Visitor Test", () => {
assert.isTrue(res.isOk() && res.value.type === "skip");
assert.isTrue(stub.calledOnce);
});
it("skip single select will trigger onDidSelection in interactive mode", async () => {
const question: SingleSelectQuestion = {
type: "singleSelect",
name: "test",
title: "test",
staticOptions: ["a"],
onDidSelection: () => {},
skipSingleOption: true,
};
const stub = sandbox.stub(question, "onDidSelection");
const inputs: Inputs = {
platform: Platform.CLI,
};
const res = await questionVisitor(question, tools.ui, inputs);
assert.isTrue(res.isOk() && res.value.type === "skip");
assert.isTrue(stub.calledOnce);
});
it("select default value will trigger onDidSelection", async () => {
const question: SingleSelectQuestion = {
type: "singleSelect",
Expand Down

0 comments on commit 2838a59

Please sign in to comment.