The pair key stays sorted for dedup, and generation now loads the two people in the order they were chosen. The report back link uses Link so the new route passes the page-link lint. Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
1.3 KiB
TypeScript
22 lines
1.3 KiB
TypeScript
import assert from "node:assert/strict";
|
||
import test from "node:test";
|
||
import { readFileSync } from "node:fs";
|
||
|
||
import { synastryDisplaySubjectIds } from "../src/lib/synastry-display-order.ts";
|
||
import { synastryFollowupTitle } from "../src/lib/synastry-report-session.ts";
|
||
|
||
test("picker order outranks the sorted pair key for the title and the chat", () => {
|
||
const ids = synastryDisplaySubjectIds("person-yi", "self", { first: "self", second: "person-yi" });
|
||
assert.deepEqual(ids, ["self", "person-yi"]);
|
||
const labels: Record<string, string> = { self: "甲", "person-yi": "乙" };
|
||
const names = { a: labels[ids[0]] ?? "", b: labels[ids[1]] ?? "" };
|
||
assert.equal(`${names.a} × ${names.b} · 婚恋合盘`, "甲 × 乙 · 婚恋合盘");
|
||
assert.equal(synastryFollowupTitle(names), "甲 × 乙 · 合盘追问");
|
||
assert.deepEqual(synastryDisplaySubjectIds("person-yi", "self", null), ["person-yi", "self"]);
|
||
const wait = readFileSync(new URL("../src/components/synastry/synastry-wait.tsx", import.meta.url), "utf8");
|
||
const run = readFileSync(new URL("../src/lib/synastry-full-run.ts", import.meta.url), "utf8");
|
||
assert.match(wait, /\$\{a\} × \$\{b\}/);
|
||
assert.match(run, /synastryDisplaySubjectIds\(/);
|
||
assert.match(run, /cardSummary: `\$\{names\.a\} × \$\{names\.b\} · 婚恋合盘`/);
|
||
});
|