-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchild-questions.test.ts
More file actions
41 lines (36 loc) · 1.36 KB
/
child-questions.test.ts
File metadata and controls
41 lines (36 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { describe, expect, test } from "bun:test";
import { detectChildQuestions } from "./child-questions.ts";
describe("detectChildQuestions", () => {
test("detects a Questions section and extracts it", () => {
const input = [
"## Plan",
"- Step 1",
"",
"## Questions:",
"- What is the base branch?",
"- Should we support Windows?",
"",
"## Verification",
"- bun run typecheck",
].join("\n");
const result = detectChildQuestions(input);
expect(result.hasQuestions).toBe(true);
expect(result.source).toBe("section");
expect(result.questionsText).toContain("What is the base branch?");
expect(result.questionsText).toContain("Should we support Windows?");
expect(result.questionsText).not.toContain("Verification");
});
test("uses a conservative heuristic for question bullets", () => {
const input = [
"Here are a few clarifications:",
"- Do we need to support Node 18?",
"- Is the output expected to be JSON?",
"We can proceed once answered.",
].join("\n");
const result = detectChildQuestions(input);
expect(result.hasQuestions).toBe(true);
expect(result.source).toBe("heuristic");
expect(result.questionsText).toContain("Do we need to support Node 18?");
expect(result.questionsText).toContain("Is the output expected to be JSON?");
});
});