diff --git a/src/components/ui/terminal.test.ts b/src/components/ui/terminal.test.ts new file mode 100644 index 0000000..21bdef6 --- /dev/null +++ b/src/components/ui/terminal.test.ts @@ -0,0 +1,20 @@ +import { createElement } from "react" +import { renderToStaticMarkup } from "react-dom/server" +import { describe, expect, it } from "vitest" + +import { Terminal } from "./terminal" + +describe("Terminal", () => { + it("wraps long unbroken log lines instead of overflowing horizontally", () => { + const longLine = `ERR! ${"a".repeat(400)}` + const html = renderToStaticMarkup( + createElement(Terminal, { logs: ["> Running checks...", longLine] }), + ) + + expect(html).toContain(longLine) + + const lineMarkup = html.slice(0, html.indexOf(longLine)) + const openingTag = lineMarkup.slice(lineMarkup.lastIndexOf("( } return ( -
+
{log}
);