fix(frontend): cap schema-linking graph on promoted count + signals in table Perché
- Cap counts promoted candidates only (was all candidates); reuse promoted list (DRY) - New test: 10 promoted + 50 excluded must not cap, graph stays available - Extract reasonFor() helper; table Perché falls back to signal keys like the flowchart Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -55,3 +55,30 @@ test("(c) oversized linking (>45) shows cap notice", () => {
|
||||
screen.getByText(/troppi elementi per il grafico/i)
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("(d) ~10 promoted + ~50 excluded does NOT cap; graph is available", async () => {
|
||||
const mixedLinking = {
|
||||
question: "caso misto",
|
||||
candidates: [
|
||||
...Array.from({ length: 10 }, (_, i) => ({
|
||||
kind: "table" as const,
|
||||
name: `kept_${i}`,
|
||||
decision: "promoted" as const,
|
||||
})),
|
||||
...Array.from({ length: 50 }, (_, i) => ({
|
||||
kind: "table" as const,
|
||||
name: `dropped_${i}`,
|
||||
decision: "excluded" as const,
|
||||
})),
|
||||
],
|
||||
joins: [],
|
||||
excluded: [],
|
||||
open_questions: [],
|
||||
};
|
||||
render(<SchemaLinkingViewer linking={mixedLinking} />);
|
||||
expect(
|
||||
screen.queryByText(/troppi elementi per il grafico/i)
|
||||
).not.toBeInTheDocument();
|
||||
// Grafico (mermaid) view is the default and renders the mocked svg.
|
||||
await waitFor(() => expect(screen.getByTestId("mm")).toBeInTheDocument());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user