import { assertEquals, assertStringIncludes } from "jsr:@std/assert@1"; import { renderErrorToastFragment } from "../../core/error_fragments.tsx"; import app from "../../main.ts"; Deno.test("[Arch] Error Fragment: renderErrorToastFragment outputs Datastar morph target #status-banner", async () => { const errorMessage = "Invalid PIN code or workshop pass expired."; const fragment = renderErrorToastFragment(errorMessage); const html = String(await fragment); assertStringIncludes(html, 'id="status-banner"'); assertStringIncludes(html, errorMessage); assertStringIncludes(html, "display: block;"); }); Deno.test("[Arch] Error Fragment: Validation errors on action routes return HTML fragments", async () => { const req = new Request("http://localhost/api/join", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}), }); const res = await app.fetch(req); assertEquals(res.status, 400); const html = await res.text(); assertStringIncludes(html, 'id="status-banner"'); assertStringIncludes(html, "Event code or PIN is required"); });