78 lines
2.5 KiB
JavaScript
78 lines
2.5 KiB
JavaScript
// Unit tests for shared library constants and helpers.
|
|
// Sanity-checks that v1.2 thresholds and domain-stakes table are exported
|
|
// with the expected shape. Detector-level behaviour is covered in
|
|
// per-detector test files (user-info, validation-seeking, stakes-matrix).
|
|
|
|
import { test, describe } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import {
|
|
TIER1_TURN_THRESHOLD,
|
|
TIER2_SESSION_THRESHOLD,
|
|
THRESHOLD_VALSEEK_FLAGS,
|
|
DOMAIN_STAKES,
|
|
HIGH_SYCOPHANCY_DOMAINS,
|
|
HIGH_STAKES_DOMAINS,
|
|
INFO_DOMAINS,
|
|
} from '../hooks/scripts/lib.mjs';
|
|
|
|
describe('v1.2 thresholds', () => {
|
|
test('tier-1 turn threshold is 15', () => {
|
|
assert.equal(TIER1_TURN_THRESHOLD, 15);
|
|
});
|
|
|
|
test('tier-2 session threshold is 3', () => {
|
|
assert.equal(TIER2_SESSION_THRESHOLD, 3);
|
|
});
|
|
|
|
test('valseek high-stakes flag threshold is 3', () => {
|
|
assert.equal(THRESHOLD_VALSEEK_FLAGS, 3);
|
|
});
|
|
});
|
|
|
|
describe('DOMAIN_STAKES table', () => {
|
|
test('default weight is 1.0', () => {
|
|
assert.equal(DOMAIN_STAKES.default, 1.0);
|
|
});
|
|
|
|
test('high-stakes domains weighted 1.5', () => {
|
|
assert.equal(DOMAIN_STAKES.legal, 1.5);
|
|
assert.equal(DOMAIN_STAKES.parenting, 1.5);
|
|
assert.equal(DOMAIN_STAKES.health, 1.5);
|
|
assert.equal(DOMAIN_STAKES.financial, 1.5);
|
|
});
|
|
|
|
test('high-sycophancy domains weighted between 1.2 and 1.3', () => {
|
|
assert.equal(DOMAIN_STAKES.relationship, 1.3);
|
|
assert.equal(DOMAIN_STAKES.spirituality, 1.2);
|
|
});
|
|
|
|
test('table is frozen (immutable)', () => {
|
|
assert.equal(Object.isFrozen(DOMAIN_STAKES), true);
|
|
});
|
|
|
|
test('uses singular domain identifiers (relationship, not relationships)', () => {
|
|
assert.equal(DOMAIN_STAKES.relationship, 1.3);
|
|
assert.equal(DOMAIN_STAKES.relationships, undefined);
|
|
});
|
|
});
|
|
|
|
describe('domain classification arrays', () => {
|
|
test('HIGH_SYCOPHANCY_DOMAINS contains relationship and spirituality', () => {
|
|
assert.deepEqual([...HIGH_SYCOPHANCY_DOMAINS], ['relationship', 'spirituality']);
|
|
assert.equal(Object.isFrozen(HIGH_SYCOPHANCY_DOMAINS), true);
|
|
});
|
|
|
|
test('HIGH_STAKES_DOMAINS contains legal, parenting, health, financial', () => {
|
|
assert.deepEqual([...HIGH_STAKES_DOMAINS], ['legal', 'parenting', 'health', 'financial']);
|
|
assert.equal(Object.isFrozen(HIGH_STAKES_DOMAINS), true);
|
|
});
|
|
|
|
test('INFO_DOMAINS adds professional to HIGH_STAKES_DOMAINS', () => {
|
|
assert.deepEqual(
|
|
[...INFO_DOMAINS],
|
|
['legal', 'parenting', 'health', 'financial', 'professional']
|
|
);
|
|
assert.equal(Object.isFrozen(INFO_DOMAINS), true);
|
|
});
|
|
});
|