ReMe/reme_studio/tests/rendered-html.test.mjs
jinliyl fe336da566
feat(studio): align branding with documentation site (#546)
* feat(studio): align branding with documentation site

* fix(studio): refine brand lockups

* fix(studio): simplify welcome branding

* docs(studio): add comprehensive visual guide

* docs: promote Studio to top-level navigation

* fix(studio): address review feedback
2026-09-15 13:29:55 +08:00

39 lines
1.3 KiB
JavaScript

import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import test from "node:test";
async function render() {
const workerUrl = new URL("../dist/server/index.js", import.meta.url);
workerUrl.searchParams.set("test", `${process.pid}-${Date.now()}`);
const { default: worker } = await import(workerUrl.href);
return worker.fetch(
new Request("http://localhost/", { headers: { accept: "text/html" } }),
{
ASSETS: { fetch: async () => new Response("Not found", { status: 404 }) },
},
{ waitUntil() {}, passThroughOnException() {} },
);
}
test("server-renders the ReMe Studio shell", async () => {
const response = await render();
assert.equal(response.status, 200);
assert.match(response.headers.get("content-type") ?? "", /^text\/html\b/i);
const html = await response.text();
const packageJson = JSON.parse(
await readFile(new URL("../package.json", import.meta.url), "utf8"),
);
assert.match(html, /<title>ReMe Studio<\/title>/i);
assert.match(
html.replaceAll("<!-- -->", ""),
new RegExp(`v${packageJson.version}`),
);
assert.match(html, /新建 Agent 对话/);
assert.match(html, /文件保留在你的本地工作区/);
assert.doesNotMatch(
html,
/codex-preview|Your site is taking shape|react-loading-skeleton/i,
);
});