Skip to content

Commit 397e1ff

Browse files
committed
test(server): cover usage-limit arm overdue boundary
Pin the 24-hour cutoff on both sides: a reset exactly 24 hours overdue still arms, and one 24 hours and 1ms overdue does not.
1 parent a23c9de commit 397e1ff

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎apps/server/src/orchestration-v2/UsageLimitRecoveryWorker.test.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,15 @@ describe("limitRecoveryCommand arming", () => {
3838
const arm = limitRecoveryCommand(thread, true, nowMs);
3939
assert.equal(arm?.type, "thread.metadata.update");
4040
});
41+
42+
it("arms a reset that is exactly 24 hours overdue", () => {
43+
const thread = failedThread(30 * HOUR_MS, 24 * HOUR_MS);
44+
const arm = limitRecoveryCommand(thread, true, nowMs);
45+
assert.equal(arm?.type, "thread.metadata.update");
46+
});
47+
48+
it("does not arm a reset that is 24 hours and 1ms overdue", () => {
49+
const thread = failedThread(30 * HOUR_MS, 24 * HOUR_MS + 1);
50+
assert.isNull(limitRecoveryCommand(thread, true, nowMs));
51+
});
4152
});

0 commit comments

Comments
 (0)