mirror of
https://github.com/multica-ai/multica.git
synced 2026-09-30 17:29:29 +08:00
MUL-6291. Vitest's own breakdown for `@multica/views` showed the shape of the problem: environment 633s and import 644s against only 508s of actual test execution. Two thirds of a cold frontend-test run went on building a jsdom per file and importing its module graph, not on running assertions. - 94 pure-logic `.test.ts` files across views/web/desktop now declare `// @vitest-environment node`. Measured on the 45 converted views files: environment 53.15s -> 4ms, wall 8.72s -> 2.03s. Candidates were picked by module-graph analysis (skipping type-only imports) and rejected when the code under test branches on `typeof window`/`document`, where node would silently take the SSR path and still pass; the remainder were verified empirically and reverted where they failed. - The three jsdom setup files bail out when there is no DOM, so a node-env suite can share them. - schedule-editor: the pure state transitions (isFullDay, displayWindow, timeAnchorOf, defaultAtTime, defaultEveryTime, clampWindow, toggleDay) move out of the component into transitions.ts, with the full combination matrix as a table-driven node-env suite. 34 cases in 3ms, replacing four DOM mounts. - Cross-layer duplicates removed where a canonical layer already owns the matrix: originSourceUrl (skills/lib/origin.test.ts) was re-run through the refresh dialog and the detail page; needsSourceBackfill (core/onboarding/needs-backfill.test.ts) through the backfill modal. Each component keeps one wiring case naming the canonical file. No behaviour change: the transitions extraction is a pure move, and every removal names where the same contract is still covered. Co-authored-by: Bohan-J <bohan@devv.ai> Co-authored-by: multica-agent <github@multica.ai>
21 lines
609 B
TypeScript
21 lines
609 B
TypeScript
// @vitest-environment node
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { isOfficialMarketingHost } from "./public-host";
|
|
|
|
describe("isOfficialMarketingHost", () => {
|
|
it.each(["multica.ai", "www.multica.ai", "MULTICA.AI", "multica.ai."])(
|
|
"recognizes %s as an official marketing host",
|
|
(host) => {
|
|
expect(isOfficialMarketingHost(host)).toBe(true);
|
|
},
|
|
);
|
|
|
|
it.each(["app.multica.ai", "api.multica.ai", "localhost", "multica.test"])(
|
|
"does not treat %s as the public marketing host",
|
|
(host) => {
|
|
expect(isOfficialMarketingHost(host)).toBe(false);
|
|
},
|
|
);
|
|
});
|