feat: add relationship-aware synastry entry (#17)

This commit is contained in:
732642856
2026-07-20 20:21:53 +08:00
committed by GitHub
parent 54015f71d4
commit 11d64d02cd
3 changed files with 104 additions and 17 deletions
@@ -23,8 +23,9 @@ test("other chart save falls back to local library when cloud sync fails", () =>
assert.doesNotMatch(source, /deleteOtherChart[\s\S]{0,500}return;\s*}\s*setChartLibrary/);
});
test("adding another chart immediately opens the synastry path", () => {
assert.match(source, /async function saveOtherChart[\s\S]{0,1400}await draftSynastryQuestionFromChart\(record\)/);
test("adding another chart waits for the user to choose a relationship type", () => {
assert.doesNotMatch(source, /async function saveOtherChart[\s\S]{0,1400}await draftSynastryQuestionFromChart\(/);
assert.match(source, /请选择关系类型后点击“用于合盘”。/);
assert.match(source, /用于合盘/);
assert.match(source, /\/api\/synastry/);
});
@@ -55,3 +56,22 @@ test("synastry selection exposes a pending state while the evidence packet is co
assert.match(source, /disabled=\{synastryPendingId !== null\}/);
assert.match(source, /synastryPendingId === record\.id \? "正在计算合盘\.\.\." : "用于合盘"/);
});
test("relationship intent selects domain-specific evidence instead of treating every pairing as romance", () => {
const route = readFileSync(new URL("../src/app/api/synastry/route.ts", import.meta.url), "utf8");
assert.match(source, /商业合作/);
assert.match(source, /亲友\/家庭/);
assert.match(source, /其他关系/);
assert.match(source, /relationshipType: SynastryRelationshipType/);
assert.match(source, /body: JSON\.stringify\(\{ selfProfile: profile, partnerProfile: record\.profile, relationshipType \}\)/);
assert.match(route, /relationshipType === "business"/);
assert.match(route, /divisions: \["D2", "D10", "D11"\]/);
assert.match(route, /"D10_Dasamsa"/);
assert.match(route, /"D11_Rudramsa"/);
assert.match(route, /blockedLayers:/);
assert.match(route, /"A10"/);
assert.match(route, /"functional_benefic_malefic"/);
assert.match(route, /"vimshottari_narayana"/);
assert.match(source, /基础商业合作证据筛查/);
assert.match(source, /relationshipType === "business"/);
});