fix: harden reviewer workflow and memory handling

This commit is contained in:
2026-07-23 12:34:23 +02:00
parent 00761ae2ca
commit 694b7dd21f
23 changed files with 728 additions and 75 deletions
@@ -46,6 +46,56 @@ test("uses memory-specific selection copy without changing selected ids", async
expect(onRespond).toHaveBeenCalledWith({ id: "u-memory", kind: "multiselect", choices: ["recommended"] });
});
test("shows the exact content and provenance for every memory option", () => {
render(
<MultiselectWidget
descriptor={{
id: "u-memory-content",
widget: "multiselect",
options: [
{
id: "mem-42",
label: "paziente attivo",
detail: "flag_attivo = TRUE",
rationale: "Confermato dal reviewer",
meta: { question_context: "Conta i pazienti attivi" },
},
],
}}
onRespond={vi.fn()}
/>
);
expect(screen.getByText("flag_attivo = TRUE")).toBeInTheDocument();
expect(screen.getByText(/Confermato dal reviewer/)).toBeInTheDocument();
expect(screen.getByText(/Conta i pazienti attivi/)).toBeInTheDocument();
});
test("renders memory detail as human-friendly Markdown", () => {
render(
<MultiselectWidget
descriptor={{
id: "u-memory-markdown",
widget: "multiselect",
selection_label: "memory da applicare",
options: [
{
id: "mem-0042",
label: "Paziente attivo",
detail: "**Definizione**\n\n- `flag_attivo = TRUE`\n- record non annullato",
},
],
}}
onRespond={vi.fn()}
/>
);
expect(screen.getByText("Definizione").tagName).toBe("STRONG");
expect(screen.getByText("flag_attivo = TRUE").tagName).toBe("CODE");
expect(screen.getByText("record non annullato").closest("li")).not.toBeNull();
expect(screen.queryByText("**Definizione**")).not.toBeInTheDocument();
});
test("select-all checks all options", async () => {
const onRespond = vi.fn();
render(