30 lines
995 B
TypeScript
30 lines
995 B
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import path from "node:path";
|
|
import { readFile } from "node:fs/promises";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const testsDir = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
async function readWorkspaceFile(relativePath: string) {
|
|
return readFile(path.join(testsDir, "..", relativePath), "utf8");
|
|
}
|
|
|
|
test("web conversations page uses a web-specific projection without pin metadata", async () => {
|
|
const [pageSource, projectionsSource] = await Promise.all([
|
|
readWorkspaceFile("src/app/conversations/page.tsx"),
|
|
readWorkspaceFile("src/lib/boss-projections.ts"),
|
|
]);
|
|
|
|
assert.match(
|
|
projectionsSource,
|
|
/export function getConversationWebItems\(/,
|
|
"expected a web-specific conversation projection helper",
|
|
);
|
|
assert.match(
|
|
pageSource,
|
|
/const conversations = getConversationWebItems\(state\);/,
|
|
"expected the web conversations page to use the web-specific projection",
|
|
);
|
|
});
|