Files
loki/scripts/test/comms.ts
T
Gandtest 39cab5d013 refactor: one comms contract for mail, auth copy, and prompt title (#217)
Email kinds, digest cadence words, and email chrome tokens live in
config/comms.ts. Templates and crons import that file — they no longer
invent zinc hex or cadence labels. Auth headings come from AUTH_COPY.
The Prompts page title is NAV.prompts. Feedback-shipped and operator
mail use the same shell as verify/reset/digest.

Co-authored-by: test <test@test>
2026-08-13 13:42:46 +02:00

28 lines
1.0 KiB
TypeScript

import assert from "node:assert/strict";
import { DIGEST_CADENCES } from "../../src/db/schema/notification-preferences";
import {
DIGEST_CADENCE_COPY,
EMAIL_THEME,
MAIL_KINDS,
mailSubject,
} from "../../src/config/comms";
import { AUTH_COPY } from "../../src/config/auth";
import { NAV } from "../../src/config/navigation";
import { PALETTE } from "../../src/lib/palette";
for (const cadence of DIGEST_CADENCES) {
assert.ok(DIGEST_CADENCE_COPY[cadence].label, `cadence ${cadence} has a label`);
}
assert.ok(MAIL_KINDS.includes("digest"));
assert.match(mailSubject("verify"), /email/i);
assert.match(mailSubject("feedback_shipped", "kivvi"), /kivvi/);
assert.equal(AUTH_COPY.signIn.title, "Welcome back");
assert.equal(NAV.prompts.label, "Prompts");
assert.equal(EMAIL_THEME.header, PALETTE.dark.surfacePage);
assert.equal(EMAIL_THEME.page, PALETTE.light.surfacePage);
assert.notEqual(EMAIL_THEME.header, PALETTE.zinc[950], "email header uses brand surface, not zinc");
console.log("✓ comms SSOT tests passed");