File size: 1,521 Bytes
9d4a3b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import { join } from "node:path";
import test from "node:test";

const root = process.cwd();

test("WebsiteBench public deployment routes are wired without QQ SMTP or Stripe coupling", async () => {
  const sendCode = await readFile(join(root, "app", "api", "auth", "send-code", "route.ts"), "utf8");
  const verifyCode = await readFile(join(root, "app", "api", "auth", "verify-code", "route.ts"), "utf8");
  const publicRegister = await readFile(join(root, "app", "public-register", "route.ts"), "utf8");
  const dockerfile = await readFile(join(root, "Dockerfile.public"), "utf8");
  const readme = await readFile(join(root, "deploy", "README-public-deployment.md"), "utf8");

  assert.match(sendCode, /issuePublicRegistrationCode/);
  assert.match(verifyCode, /verifyPublicRegistrationCode/);
  assert.match(publicRegister, /consumePublicRegistrationTicket/);
  assert.match(publicRegister, /headers:\s*\{\s*Location:\s*"\/feed"\s*\}/s);
  assert.doesNotMatch(publicRegister, /NextResponse\.redirect\(new URL\("\/feed"/);
  assert.doesNotMatch(sendCode + verifyCode + publicRegister, /nodemailer|SMTP|QQ|stripe/i);
  assert.match(dockerfile, /PUBLIC_CLONE_AUTH_MODE=redis-resend/);
  assert.match(dockerfile, /PUBLIC_CLONE_AUTH_REDIS_REST_URL=http:\/\/redis\.internal/);
  assert.match(dockerfile, /PUBLIC_CLONE_AUTH_RESEND_API_URL=http:\/\/resend\.internal\/emails/);
  assert.match(readme, /Stripe remains workflow-pending/);
});