Files
optima/tests/unit/algoColdThreshold.test.ts
T

45 lines
1.6 KiB
TypeScript

/**
* Tests for src/modules/algorithms/algo.coldThreshold.ts
*
* checkColdStatus is currently bypassed (always returns not-cold).
* COLD_THRESHOLDS config is still tested.
*/
import { describe, test, expect } from "bun:test";
import {
checkColdStatus,
COLD_THRESHOLDS,
} from "../../src/modules/algorithms/algo.coldThreshold";
describe("COLD_THRESHOLDS", () => {
test("defines thresholds for QuoteSent (43) and ConfirmedQuote (57)", () => {
expect(COLD_THRESHOLDS[43]).toBeDefined();
expect(COLD_THRESHOLDS[43].days).toBe(14);
expect(COLD_THRESHOLDS[57]).toBeDefined();
expect(COLD_THRESHOLDS[57].days).toBe(30);
});
test("ms values match day values", () => {
expect(COLD_THRESHOLDS[43].ms).toBe(14 * 24 * 60 * 60 * 1000);
expect(COLD_THRESHOLDS[57].ms).toBe(30 * 24 * 60 * 60 * 1000);
});
});
describe("checkColdStatus (bypassed)", () => {
test("always returns not-cold regardless of input", () => {
// With null status
expect(checkColdStatus({ statusCwId: null, lastActivityDate: new Date() }))
.toEqual({ cold: false, triggeredBy: null });
// With eligible status and stale activity
const now = new Date("2026-03-16T00:00:00Z");
const lastActivity = new Date("2026-03-01T00:00:00Z"); // 15 days ago
expect(checkColdStatus({ statusCwId: 43, lastActivityDate: lastActivity, now }))
.toEqual({ cold: false, triggeredBy: null });
// With ConfirmedQuote exceeding threshold
expect(checkColdStatus({ statusCwId: 57, lastActivityDate: new Date("2026-02-01"), now: new Date("2026-04-01") }))
.toEqual({ cold: false, triggeredBy: null });
});
});