bypass checkColdStatus — always returns not-cold until feature ready

This commit is contained in:
2026-03-09 03:33:59 -05:00
parent e294791858
commit ee3e0a7377
3 changed files with 20 additions and 154 deletions
+4 -32
View File
@@ -93,38 +93,10 @@ const REAL_COLD_THRESHOLDS: Record<number, { days: number; ms: number }> = {
57: { days: 30, ms: 30 * 24 * 60 * 60 * 1000 },
};
const REAL_STATUS_NAMES: Record<number, string> = {
43: "QuoteSent",
57: "ConfirmedQuote",
};
/** Real checkColdStatus implementation — used as the default so that
* algoColdThreshold.test.ts gets the real function if it loads after us. */
function realCheckColdStatus(input: {
statusCwId: number | null;
lastActivityDate: Date | null;
now?: Date;
}) {
const NOT_COLD = { cold: false as const, triggeredBy: null };
if (!input.statusCwId) return NOT_COLD;
const threshold = REAL_COLD_THRESHOLDS[input.statusCwId];
if (!threshold) return NOT_COLD;
if (!input.lastActivityDate) return NOT_COLD;
const now = input.now ?? new Date();
const elapsed = now.getTime() - input.lastActivityDate.getTime();
if (elapsed < threshold.ms) return NOT_COLD;
return {
cold: true as const,
triggeredBy: {
statusCwId: input.statusCwId,
statusName: REAL_STATUS_NAMES[input.statusCwId] ?? "Unknown",
thresholdDays: threshold.days,
staleDays: Math.floor(elapsed / (24 * 60 * 60 * 1000)),
},
};
}
const mockCheckColdStatus = mock(realCheckColdStatus);
/** checkColdStatus is bypassed in source — always returns not-cold. */
const mockCheckColdStatus = mock(
() => ({ cold: false as const, triggeredBy: null }),
);
mock.module("../../src/modules/algorithms/algo.coldThreshold", () => ({
checkColdStatus: mockCheckColdStatus,