import { expect, test } from "bun:test"; import { parse } from "@wrnexus/syntax"; import { analyzeRuntimeRequirements, routeNeedsIslands } from "../src/analysis.ts"; test("a route with an island import needs client JavaScript", () => { expect( routeNeedsIslands([ { declaration: { source: "./a" } as any, resolved: "/app/a.ts" }, { declaration: { source: "./Chart" } as any, resolved: "/app/Chart.tsx", kind: "island" }, ]), ).toBe(true); }); test("a route with no island imports stays zero-JS", () => { expect( routeNeedsIslands([{ declaration: { source: "./a" } as any, resolved: "/app/a.ts" }]), ).toBe(false); }); test("an empty import list stays zero-JS", () => { expect(routeNeedsIslands([])).toBe(false); }); test("an unresolved import does not count as an island", () => { expect( routeNeedsIslands([ { declaration: { source: "./missing" } as any, diagnostic: { code: "WRN-IMPORT-NOT-FOUND", message: "nope", severity: "warning" }, }, ]), ).toBe(false); }); test("an island promotes a static route to static-interactive", () => { const source = `page Home { view {