Files
Jyotisha/frontend/tests/chart-view-varga-dignity.test.ts
T
Jesse_ChenandClaude Opus 5.5 ae18952e51
Independent Staging Quality Gate / validate (push) Successful in 15m27s
Independent Staging Quality Gate / publish (push) Successful in 3m42s
fix(report,chart): blank columns — drop Kranti, split Ashtakavarga house SAV, ascendant nakshatra, engine varga dignity, no duplicate charts (BUG-1199..1203)
- Report p33 table: no Kranti column (no producer; materials.kranti stays blocked).
- Report p53 table: the "SAV" column was the with-Lagna total (386). Split in the
  reader into SAV / Lagna BAV / SAV + Lagna with a totals row; ashtakavarga.py is
  untouched (frozen rectification identity, ERR-115).
- /api/chart ascendant carries nakshatra / pada / lord (_nakshatra_fields shared with
  the nine bodies); chart cache schema 4 -> 5.
- /api/varga_full bodies carry dignity_level from varga_dignity_level, the function
  the Vimsopaka path now shares (A/B identical); the chart page shows the D1 status
  wording and no longer derives a three-level dignity itself.
- Report page draws each chart once: the trailing block skips charts the body already
  fenced (same rule as the export); the birth-time caveat moves under the body's
  chart heading.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017eEAG8HD3mm8gsKXgk8uU8
2026-10-03 09:11:15 +08:00

30 lines
1.5 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import { VARGA_DIGNITY_LABEL, VARGA_DIGNITY_LEVELS, vargaDignityLevel, vargaMeaning } from "../src/lib/chart-view-varga.ts";
// BUG-1202: the level is the engine's (`/api/varga_full` dignity_level); the
// page only validates it and labels it with the D1 status wording, pinned to
// jyotish_engine.DIGNITY_LABELS by tests/test_chart_page_vedic_tables_contract.py.
test("engine dignity levels are accepted as-is and anything else is unknown", () => {
for (const level of VARGA_DIGNITY_LEVELS) assert.equal(vargaDignityLevel(level), level);
assert.equal(vargaDignityLevel("exalted"), null, "the retired three-level values are not engine levels");
assert.equal(vargaDignityLevel(undefined), null);
assert.equal(vargaDignityLevel(1), null);
});
test("every engine level has the D1 status wording", () => {
assert.equal(VARGA_DIGNITY_LABEL.EXALTED, "入旺(Exalted)");
assert.equal(VARGA_DIGNITY_LABEL.OWN_SIGN, "入庙(Own Sign)");
assert.equal(VARGA_DIGNITY_LABEL.ENEMY, "入敌(Enemy Sign)");
assert.equal(VARGA_DIGNITY_LABEL.NEUTRAL, "中性(Neutral)");
assert.deepEqual(Object.keys(VARGA_DIGNITY_LABEL).sort(), [...VARGA_DIGNITY_LEVELS].sort());
});
test("varga meanings come from the engine table including D40, D45 and D60", () => {
assert.equal(vargaMeaning(9), "配偶/灵性");
assert.equal(vargaMeaning(45), "全面判断");
assert.equal(vargaMeaning(60), "前世业力");
assert.equal(vargaMeaning(81), null);
});