test(FN-1893): add comprehensive QMD test coverage

- Add QMD route success tests in dashboard routes
- Expand QMD prompt completeness tests in executor
- Add QMD bootstrap and instruction completeness tests in triage
- Add QMD convenience function integration tests in memory-backend and project-memory
This commit is contained in:
Fusion
2026-04-15 23:09:02 -07:00
committed by gsxdsm
parent 738ff223aa
commit 37fdcc99a7
5 changed files with 189 additions and 0 deletions

View File

@@ -2408,6 +2408,25 @@ describe("buildExecutionPrompt", () => {
expect(memorySection).toMatch(/consult.*project memory/i);
});
it("QMD prompt has actionable memory instructions", () => {
const task = createMockTaskDetail();
const result = buildExecutionPrompt(task, "/project", {
memoryEnabled: true,
memoryBackendType: "qmd",
} as any);
expect(result).toContain("## Project Memory");
// Extract the Project Memory section
const memorySectionMatch = result.match(/## Project Memory\n([\s\S]*?)(?=\n## [^#]|$)/);
expect(memorySectionMatch).toBeTruthy();
const memorySection = memorySectionMatch![1];
// QMD should NOT contain .fusion/memory.md
expect(memorySection).not.toContain(".fusion/memory.md");
// Contains consult guidance at start of execution
expect(memorySection).toMatch(/consult.*memory/i);
// Contains "end of execution" write guidance
expect(memorySection).toMatch(/end of execution/i);
});
it("excludes memory section when memoryEnabled: false regardless of backend", () => {
const task = createMockTaskDetail();
const result = buildExecutionPrompt(task, "/project", {

View File

@@ -380,6 +380,28 @@ describe("buildSpecificationPrompt", () => {
// Should instruct to consult project memory
expect(prompt).toMatch(/consult.*project memory/i);
});
it("QMD prompt has actionable memory instructions", () => {
const settings: Settings = {
maxConcurrent: 2,
maxWorktrees: 4,
pollIntervalMs: 10000,
groupOverlappingFiles: false,
autoMerge: true,
memoryEnabled: true,
memoryBackendType: "qmd",
};
const prompt = buildSpecificationPrompt(
baseTask,
".fusion/tasks/KB-001/PROMPT.md",
settings,
);
expect(prompt).toContain("## Project Memory");
// QMD should NOT contain .fusion/memory.md
expect(prompt).not.toContain(".fusion/memory.md");
// Contains consult guidance
expect(prompt).toMatch(/consult.*memory/i);
});
});
describe("user comments", () => {