


























@@ -364,12 +364,13 @@ describe("clearExpiredCooldowns", () => {
364364});
365365366366it("clears expired cooldownUntil and resets errorCount", () => {
367+const lastFailureAt = Date.now() - 120_000;
367368const store = makeStore({
368369"anthropic:default": {
369370cooldownUntil: Date.now() - 1_000,
370371errorCount: 4,
371372failureCounts: { rate_limit: 3, timeout: 1 },
372-lastFailureAt: Date.now() - 120_000,
373+ lastFailureAt,
373374},
374375});
375376@@ -380,7 +381,7 @@ describe("clearExpiredCooldowns", () => {
380381expect(stats?.errorCount).toBe(0);
381382expect(stats?.failureCounts).toBeUndefined();
382383// lastFailureAt preserved for failureWindowMs decay
383-expect(stats?.lastFailureAt).toEqual(expect.any(Number));
384+expect(stats?.lastFailureAt).toBe(lastFailureAt);
384385});
385386386387it("clears expired disabledUntil and disabledReason", () => {
@@ -610,6 +611,7 @@ describe("markAuthProfileUsed", () => {
610611611612storeMocks.updateAuthProfileStoreWithLock.mockResolvedValue(null);
612613614+const beforeUsed = Date.now();
613615await markAuthProfileUsed({
614616 store,
615617profileId: "anthropic:default",
@@ -622,7 +624,7 @@ describe("markAuthProfileUsed", () => {
622624);
623625expect(store.usageStats?.["anthropic:default"]?.errorCount).toBe(0);
624626expect(store.usageStats?.["anthropic:default"]?.cooldownUntil).toBeUndefined();
625-expect(store.usageStats?.["anthropic:default"]?.lastUsed).toEqual(expect.any(Number));
627+expect(store.usageStats?.["anthropic:default"]?.lastUsed).toBeGreaterThanOrEqual(beforeUsed);
626628});
627629628630it("adopts locked store usage stats without saving locally when lock update succeeds", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。