29 lines
1.1 KiB
TypeScript
29 lines
1.1 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 appUiPath = path.join(testsDir, "../src/components/app-ui.tsx");
|
|
|
|
test("ProjectHeaderActions switches the fourth shortcut to participants for group chats", async () => {
|
|
const source = await readFile(appUiPath, "utf8");
|
|
|
|
assert.match(
|
|
source,
|
|
/export function ProjectHeaderActions\(\{ projectId, isGroup = false \}: \{ projectId: string; isGroup\?: boolean \}\)/,
|
|
"expected header actions to accept an isGroup hint",
|
|
);
|
|
assert.match(
|
|
source,
|
|
/href=\{isGroup \? `\/conversations\/\$\{projectId\}\/participants` : `\/conversations\/\$\{projectId\}\/thread-status`\}/,
|
|
"expected group chats to route the fourth shortcut to the participants page",
|
|
);
|
|
assert.match(
|
|
source,
|
|
/\{isGroup \? "成员状态" : "线程状态"\}/,
|
|
"expected the fourth shortcut label to change for group chats",
|
|
);
|
|
});
|