Files
boss/tests/web-group-participants-page.test.ts

54 lines
1.8 KiB
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));
const participantsPagePath = path.join(testsDir, "../src/app/conversations/[projectId]/participants/page.tsx");
test("web group participants page renders participant status from project detail payload", async () => {
const source = await readFile(participantsPagePath, "utf8");
assert.match(
source,
/getProjectDetailView\(state, projectId, session\.account\)/,
"expected participants page to derive its state from project detail payload",
);
assert.match(
source,
/detail\.participantsPayload/,
"expected participants page to consume participantsPayload from project detail",
);
assert.match(
source,
/participant\.statusLabel \?\? participant\.status/,
"expected participants page to surface each participant status label",
);
assert.match(
source,
/repairRequired/,
"expected participants page to render repair state when the group is dirty",
);
assert.match(
source,
/GroupParticipantsRepairClient/,
"expected participants page to mount a dedicated repair client when the group needs repair",
);
assert.match(
source,
/availableThreads=\{/,
"expected participants page to pass selectable thread candidates into the repair client",
);
assert.match(
source,
/participant\.canOpenProject \? \(/,
"expected participants page to branch on whether a participant still has an openable project reference",
);
assert.match(
source,
/href=\{`\/conversations\/\$\{participant\.projectId\}`\}/,
"expected participants page to expose a direct conversation link for openable participants",
);
});