feat(viewer): artifact modal renders structured text, never raw JSON
ArtifactView's fallback (StructuredValue) turns any object/array into labelled
sections, bullet lists and paragraphs (strings as markdown). Verified against the
real F1 gate (kind:"text", {recap, chiarimenti_risolti[], ...}). MarkdownView
uses the real .thot-prose class (Tailwind Typography is not installed).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -26,9 +26,23 @@ test("question renders markdown headings", () => {
|
||||
expect(screen.getByText("Domanda")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("unknown kind falls back to formatted JSON", () => {
|
||||
render(<ArtifactView artifact={{ kind: "mystery", data: { a: 1 } }} />);
|
||||
expect(screen.getByText(/"a": 1/)).toBeInTheDocument();
|
||||
test("unknown object kind renders as formatted sections, never raw JSON", () => {
|
||||
render(
|
||||
<ArtifactView
|
||||
artifact={{
|
||||
kind: "phase",
|
||||
data: {
|
||||
recap: "Domanda: lista pazienti.",
|
||||
chiarimenti_risolti: ["finestra_temporale — 5 anni", "tipo_evento — solo impianto"],
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
// Humanized section labels, values as text/bullets — and NO raw JSON braces.
|
||||
expect(screen.getByText("Recap")).toBeInTheDocument();
|
||||
expect(screen.getByText("Chiarimenti risolti")).toBeInTheDocument();
|
||||
expect(screen.getByText("finestra_temporale — 5 anni")).toBeInTheDocument();
|
||||
expect(screen.queryByText(/"recap"/)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("schema_linking renders the schema viewer", async () => {
|
||||
|
||||
Reference in New Issue
Block a user