Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(control-api): freeze the clock in the shared rate-limit tests
Jose Gabriel Ramirez Encinasc3bdfbdd56b4
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex 092d6afee..e202849e8 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.738",+ "version": "0.1.739","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.738",+ "version": "0.1.739","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",diff --git a/control-api/package.json b/control-api/package.jsonindex 2b01bf382..38771b118 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.738",+ "version": "0.1.739","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/test/workflows.shared.rateLimit.test.ts b/control-api/test/workflows.shared.rateLimit.test.tsindex 6b7aed01a..fe6149970 100644--- a/control-api/test/workflows.shared.rateLimit.test.ts+++ b/control-api/test/workflows.shared.rateLimit.test.ts@@ -71,6 +71,15 @@ function pgAllows() {}describe('routes/workflows/shared/rateLimit', () => {+ // The ledger mock and the edge limiter both use wall-clock minute windows.+ // Freeze Date mid-window so a loop that crosses a real minute boundary+ // cannot reset the budget before the expected 429. Tests that exercise+ // window recovery set their own system time.+ beforeEach(() => {+ vi.useFakeTimers({ toFake: ['Date'] })+ vi.setSystemTime(1_800_000_030_000)+ })+afterEach(() => {vi.useRealTimers()})