Open-source AI coworkers that each get a computer of their own: a browser, files and tools, with every action decided before it happens and recorded after. Bring any AG-UI agent.
import { expect, test } from "bun:test";
import { router } from "../src/router";
import {
routeBuildRollupOutputOptions,
routeCodeSplittingOptions,
selectedRouteSplitBehavior,
selectOpenBotManualChunk,
} from "../vite.config";
test("provides the generated index route", () => {
expect(router.routesByPath["/"]?.fullPath).toBe("/");
});
test("provides the generated sign-in and chat routes", () => {
expect(router.routesByPath["/sign"]?.fullPath).toBe("/sign");
expect(router.routesByPath["/channel/$channelId"]?.fullPath).toBe(
"/channel/$channelId",
);
});
test("provides the protected credential administration route", () => {
expect(router.routesByPath["/admin/credentials"]?.fullPath).toBe(
"/admin/credentials",
);
});
test("splits route components without splitting loaders or providers", () => {
expect(routeCodeSplittingOptions.defaultBehavior).toEqual([]);
expect(selectedRouteSplitBehavior({ routeId: "/sign" })).toEqual([
["component"],
]);
expect(
selectedRouteSplitBehavior({ routeId: "/_authed/_app/channel/$channelId" }),
).toEqual([["component"]]);
expect(selectedRouteSplitBehavior({ routeId: "/admin/credentials" })).toEqual(
[["component"]],
);
expect(
selectedRouteSplitBehavior({ routeId: "/settings/connected-accounts/" }),
).toEqual([["component"]]);
expect(selectedRouteSplitBehavior({ routeId: "/" })).toBeUndefined();
});
test("uses explicit manual chunks for route components", () => {
expect(routeBuildRollupOutputOptions.onlyExplicitManualChunks).toBe(true);
expect(
selectOpenBotManualChunk(
"/repo/app/src/routes/sign.tsx?tsr-split=component",
),
).toBe("route-sign");
expect(
selectOpenBotManualChunk(
"C:\\repo\\app\\src\\routes\\_authed\\_app\\channel\\$channelId.tsx?tsr-split=component",
),
).toBe("route-chat-core");
expect(
selectOpenBotManualChunk(
"/repo/app/src/routes/_authed/admin/credentials.tsx?tsr-split=component",
),
).toBe("route-admin");
expect(
selectOpenBotManualChunk(
"/repo/app/src/routes/_authed/settings/connected-accounts/index.tsx?tsr-split=component",
),
).toBe("route-settings");
expect(
selectOpenBotManualChunk(
"/repo/app/src/routes/_authed/_app/agents/index.tsx?tsr-split=component",
),
).toBe("route-app-secondary");
});
test("does not manually chunk lazy content or dependencies", () => {
expect(
selectOpenBotManualChunk(
"/repo/app/src/routes/_authed/_app/channel/$channelId.tsx?tsr-split=loader",
),
).toBeUndefined();
expect(
selectOpenBotManualChunk(
"/repo/app/src/components/markdown/lazy-mermaid.tsx",
),
).toBeUndefined();
expect(
selectOpenBotManualChunk(
"/repo/node_modules/.bun/[email protected]/node_modules/mermaid/dist/mermaid.core.mjs",
),
).toBeUndefined();
expect(
selectOpenBotManualChunk(
"/repo/node_modules/.bun/@[email protected]/node_modules/@copilotkit/react-core/dist/index.js",
),
).toBeUndefined();
expect(
selectOpenBotManualChunk(
"/repo/node_modules/.bun/[email protected]/node_modules/react-dom/client.js",
),
).toBeUndefined();
});