Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
1.9 kB ยท 51 lines
TSX
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152import { expect } from "@std/expect";import { describe, it } from "@std/testing/bdd";import { renderToStaticMarkup } from "react-dom/server";
import { ProcessMessage } from "./process-message";
function render(value: string) { return renderToStaticMarkup(<ProcessMessage value={value} />);}
describe("ProcessMessage", () => { it("renders markdown formatting", () => { const html = render("We are **investigating** `api` latency."); expect(html).toContain("<strong>investigating</strong>"); expect(html).toContain("<code>api</code>"); });
it("opens links in a new tab without a referrer", () => { const html = render("See [the docs](https://docs.openstatus.dev)."); expect(html).toMatch( /<a [^>]*href="https:\/\/docs\.openstatus\.dev"[^>]*>the docs<\/a>/, ); expect(html).toContain('target="_blank"'); expect(html).toContain('rel="noreferrer"'); });
it("styles unordered lists and keeps their items", () => { const html = render("- first\n- second"); expect(html).toContain("list-disc"); expect(html).toContain("<li>first</li>"); expect(html).toContain("<li>second</li>"); });
it("does not render raw HTML from the message", () => { const html = render('<img src=x onerror="alert(1)">\n\n<script>x</script>'); expect(html).not.toContain("<img"); expect(html).not.toContain("<script"); });
// remark keeps the URL; React swaps it for a throwing stub it("does not ship a javascript: link payload", () => { expect(render("[click](javascript:alert(1))")).not.toContain("alert(1)"); });
// the `ol` override drops its props, so ordered list items vanish it.ignore("keeps the items of ordered lists", () => { const html = render("1. first\n2. second"); expect(html).toContain("list-decimal"); expect(html).toContain("<li>first</li>"); });});