fix(test): reset dedup cache between ask-user-freetext tests

The per-turn dedup cache introduced in the parent commit persists across
test cases since they all use the same question signature. Test 1 populates
the cache, causing tests 2 and 3 to get cached results instead of exercising
their intended code paths.
This commit is contained in:
Jeremy 2026-04-04 19:59:54 -05:00
parent eed833138d
commit ca55b5c269

View file

@ -10,12 +10,13 @@
* triggers a follow-up free-text input prompt via ctx.ui.input().
*/
import { describe, it } from "node:test";
import { describe, it, beforeEach } from "node:test";
import assert from "node:assert/strict";
// The ask-user-questions extension registers a tool via pi.registerTool().
// We capture that registration and call execute() directly with a mock context.
import AskUserQuestions from "../../ask-user-questions.js";
import { resetAskUserQuestionsCache } from "../../ask-user-questions.js";
interface CapturedTool {
name: string;
@ -73,6 +74,10 @@ function makeMockCtx(opts: {
}
describe("ask-user-questions RPC fallback free-text", () => {
beforeEach(() => {
resetAskUserQuestionsCache();
});
it("prompts for free-text input when user selects 'None of the above'", async () => {
const tool = captureTool();
const { ctx, selectCalls, inputCalls } = makeMockCtx({