import { expect, test } from "bun:test"; import { renderToStaticMarkup } from "react-dom/server"; import { ShareView } from "./view"; test("share rendering escapes content and protects external links", () => { const html = renderToStaticMarkup(", text: "", sourceUrl: "https://example.com/story", }, createdAt: "2026-08-21T00:00:00Z", expiresAt: "2026-09-20T00:00:00Z", ownedByViewer: true, }} onDelete={() => {}} />); expect(html).not.toContain("", description: "Movers I watch daily.", data: { symbols: ["AAPL", "MSFT"], lookbackDays: 90, blank: " ", nestedConfig: { hidden: true }, }, }, createdAt: "2026-08-25T00:00:00Z", expiresAt: "2026-09-24T00:00:00Z", ownedByViewer: true, }} openLiveUrl="https://api.gloom.sh/shares/abc/open" onDelete={() => {}} />); expect(html).toContain("Shared via Gloomberb"); expect(html).toContain("A free, open-source finance terminal for market data, charts, and research."); expect(html).toContain('href="https://api.gloom.sh/shares/abc/open"'); expect(html).toContain("Explore this pane live"); expect(html).toContain("Movers I watch daily."); expect(html).toContain("Symbols"); expect(html).toContain("AAPL, MSFT"); expect(html).toContain("Lookback Days"); expect(html).not.toContain("[object Object]"); expect(html).not.toContain("Nested Config"); expect(html).not.toContain("Blank"); expect(html).not.toContain("