test: stabilize gateway wizard e2e flow

This commit is contained in:
Peter Steinberger
2026-04-05 13:05:50 +09:00
parent 4cfb990382
commit 5e0e50b12e
3 changed files with 44 additions and 5 deletions

View File

@@ -71,4 +71,23 @@ describe("WizardSession", () => {
expect(done.done).toBe(true);
expect(done.status).toBe("cancelled");
});
test("does not lose terminal completion when the last answer finishes the runner immediately", async () => {
const session = new WizardSession(async (prompter) => {
await prompter.text({ message: "Token" });
});
const first = await session.next();
expect(first.step?.type).toBe("text");
if (!first.step) {
throw new Error("expected first step");
}
await session.answer(first.step.id, "ok");
await Promise.resolve();
const done = await session.next();
expect(done.done).toBe(true);
expect(done.status).toBe("done");
});
});