import { describe, expect, it } from "vitest"; import { startUiServer } from "../server"; describe("ui web shell", () => { it("serves a stream-first shell and static browser assets", async () => { const server = await startUiServer({ address: "127.0.0.1", token: "tok", preferredPort: 0, }); try { const shell = await fetch(`${server.baseUrl}/?token=tok`); expect(shell.status).toBe(200); const html = await shell.text(); expect(html).toContain('id="ui-progress"'); expect(html).toContain('id="ui-meta"'); expect(html).toContain('id="ui-stream"'); expect(html).toContain('id="ui-composer"'); expect(html).toContain('type="module"'); expect(html).toContain("/assets/app.js"); const js = await fetch(`${server.baseUrl}/assets/app.js`, { headers: { authorization: "Bearer tok" }, }); expect(js.status).toBe(200); expect(await js.text()).toContain("fetchSnapshot"); const css = await fetch(`${server.baseUrl}/assets/app.css`, { headers: { authorization: "Bearer tok" }, }); expect(css.status).toBe(200); expect(await css.text()).toContain("#ui-stream"); } finally { await server.close("test"); } }); });