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); });