Files
Jyotisha/frontend/tests/chart-view-varga-dignity.test.ts
T

25 lines
1.2 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import { vargaDignity, vargaMeaning } from "../src/lib/chart-view-varga.ts";
// The tables are pinned to the engine by tests/test_chart_page_vedic_tables_contract.py;
// this pins the precedence (exalted, own, debilitated) the Python test mirrors.
test("sign dignity follows the engine's precedence and node own signs", () => {
assert.equal(vargaDignity("Sun", "Aries"), "exalted");
assert.equal(vargaDignity("Sun", "Leo"), "own");
assert.equal(vargaDignity("Sun", "Libra"), "debilitated");
assert.equal(vargaDignity("Mercury", "Virgo"), "exalted", "exaltation wins over own sign");
assert.equal(vargaDignity("Rahu", "Virgo"), "own");
assert.equal(vargaDignity("Ketu", "Pisces"), "own");
assert.equal(vargaDignity("Rahu", "Taurus"), null, "the engine has no node exaltation");
assert.equal(vargaDignity("Moon", "Leo"), null);
});
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);
});