import { expect, rs, test } from "@rstest/core"; import { renderToString } from "react-dom/server"; import { useLocalSettings } from "@/core/settings/hooks"; import { UserPreferencesBoundary } from "@/core/settings/user-preferences-boundary"; const mocks = rs.hoisted(() => ({ start: rs.fn() })); rs.mock("@/core/auth/AuthProvider", () => ({ useAuth: () => ({ user: { id: "alice" } }), })); rs.mock("@/core/static-mode", () => ({ isStaticWebsiteOnly: () => false })); rs.mock("@/core/settings/user-preferences", () => ({ startUserPreferences: mocks.start, })); function Workspace() { const [settings] = useLocalSettings(); return (
{settings.context.model_name ?? "default"}
); } test("signed-in workspace content remains in server HTML without starting browser sync", () => { const html = renderToString( , ); expect(html).toContain(""); expect(html).toContain("default"); expect(mocks.start).not.toHaveBeenCalled(); });