Files
edgeever/tests/worker-bundle-boundary.test.ts
T
tianma-if d367f05821 perf: reduce Worker auth and sync overhead
Move workspace provisioning and seed work off the authentication hot path, compact sync changes, optimize cursor queries, and keep browser-only KaTeX rendering out of the Worker bundle.\n\nRefs #244
2026-08-14 16:44:38 +08:00

21 lines
1.0 KiB
TypeScript

import { describe, expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
const repositoryRoot = resolve(import.meta.dir, "..");
const readRepositoryFile = (path: string) => readFileSync(resolve(repositoryRoot, path), "utf8");
describe("Worker bundle boundaries", () => {
test("keeps the KaTeX renderer behind the browser-only mathematics entry", () => {
const packageJson = JSON.parse(readRepositoryFile("packages/shared/package.json"));
const sharedIndex = readRepositoryFile("packages/shared/src/index.ts");
const contentSource = readRepositoryFile("packages/shared/src/content.ts");
expect(packageJson.exports["./mathematics"]).toBe("./src/mathematics.ts");
expect(sharedIndex).not.toContain('export * from "./mathematics"');
expect(contentSource).toContain('from "./mathematics-markdown"');
expect(contentSource).not.toContain('from "./mathematics"');
expect(contentSource).not.toContain("createEdgeEverMathematics");
});
});