返回 DeepSeek-Reasonix
account-community-contract.test.mjs
根目录 / site / src / scripts / account-community-contract.test.mjs
1 import assert from "node:assert/strict";
2 import { readFileSync } from "node:fs";
3 import test from "node:test";
4
5 const auth = readFileSync(new URL("./auth.js", import.meta.url), "utf8");
6 const community = readFileSync(new URL("./community.js", import.meta.url), "utf8");
7 const account = readFileSync(new URL("../pages/account.astro", import.meta.url), "utf8");
8 const profile = readFileSync(new URL("../pages/u/index.astro", import.meta.url), "utf8");
9
10 test("unverified accounts can request a fresh verification email", () => {
11 assert.match(account, /resend-verification-btn/);
12 assert.match(auth, /\/auth\/resend-verification/);
13 });
14
15 test("public profiles have a generated site route backed by the public account API", () => {
16 assert.match(profile, /public-profile/);
17 assert.match(auth, /api\("\/u\/" \+ encodeURIComponent\(handle\)\)/);
18 });
19
20 test("community renders public handles and wires reactions", () => {
21 assert.doesNotMatch(community, /split\(["']@["']\)/);
22 assert.match(community, /\/posts\/\$\{like\.dataset\.like\}\/likes/);
23 assert.match(community, /aria-pressed/);
24 });
25
25 lines Plain Text