feat: add opportunity workflows, delete routes, company sites, algorithms, and expanded test coverage

This commit is contained in:
2026-03-09 02:56:08 -05:00
parent c0a4d4f919
commit f53b390e18
50 changed files with 8837 additions and 63 deletions
+17 -8
View File
@@ -20,14 +20,19 @@ describe("computeProductsCacheTTL", () => {
});
// -- Won/Lost status set ------------------------------------------------
test("WON_LOST_STATUS_IDS contains Won canonical ID (29) and Pending Won (49)", () => {
test("WON_LOST_STATUS_IDS contains Won canonical ID (29)", () => {
expect(WON_LOST_STATUS_IDS.has(29)).toBe(true);
expect(WON_LOST_STATUS_IDS.has(49)).toBe(true);
});
test("WON_LOST_STATUS_IDS contains Lost canonical ID (53) and Pending Lost (50)", () => {
test("WON_LOST_STATUS_IDS contains Lost canonical ID (53) and Canceled (59)", () => {
expect(WON_LOST_STATUS_IDS.has(53)).toBe(true);
expect(WON_LOST_STATUS_IDS.has(50)).toBe(true);
expect(WON_LOST_STATUS_IDS.has(59)).toBe(true);
});
test("WON_LOST_STATUS_IDS does not contain Pending Won (49) or Pending Lost (50)", () => {
// Pending Won/Lost do not have wonFlag/lostFlag set in QuoteStatuses
expect(WON_LOST_STATUS_IDS.has(49)).toBe(false);
expect(WON_LOST_STATUS_IDS.has(50)).toBe(false);
});
test("WON_LOST_STATUS_IDS does not contain Active (58) or New (24)", () => {
@@ -48,7 +53,9 @@ describe("computeProductsCacheTTL", () => {
expect(result).toBeNull();
});
test("returns null for Pending Won status (CW ID 49)", () => {
test("returns PRODUCTS_TTL_HOT for Pending Won status (CW ID 49) with recent activity", () => {
// Pending Won is not in WON_LOST_STATUS_IDS (no wonFlag), so it falls
// through to the activity-based rules.
const result = computeProductsCacheTTL({
statusCwId: 49,
closedFlag: false,
@@ -57,7 +64,7 @@ describe("computeProductsCacheTTL", () => {
lastUpdated: new Date(NOW.getTime() - 1 * DAY_MS),
now: NOW,
});
expect(result).toBeNull();
expect(result).toBe(PRODUCTS_TTL_HOT);
});
test("returns null for Lost status (CW ID 53)", () => {
@@ -72,7 +79,9 @@ describe("computeProductsCacheTTL", () => {
expect(result).toBeNull();
});
test("returns null for Pending Lost status (CW ID 50)", () => {
test("returns PRODUCTS_TTL_HOT for Pending Lost status (CW ID 50) with recent activity", () => {
// Pending Lost is not in WON_LOST_STATUS_IDS (no lostFlag), so it falls
// through to the activity-based rules.
const result = computeProductsCacheTTL({
statusCwId: 50,
closedFlag: false,
@@ -81,7 +90,7 @@ describe("computeProductsCacheTTL", () => {
lastUpdated: new Date(NOW.getTime() - 1 * DAY_MS),
now: NOW,
});
expect(result).toBeNull();
expect(result).toBe(PRODUCTS_TTL_HOT);
});
// -- Rule 2: Opp not cacheable → null ----------------------------------