test: tighten auth profile locked success timestamp assertion · openclaw/openclaw@4eaa726
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -51,7 +51,6 @@ describe("markAuthProfileSuccess", () => {
|
51 | 51 | profileId: "anthropic:default", |
52 | 52 | agentDir: "/tmp/openclaw-auth-profiles-success", |
53 | 53 | }); |
54 | | - |
55 | 54 | expect(storeMocks.saveAuthProfileStore).toHaveBeenCalledWith( |
56 | 55 | store, |
57 | 56 | "/tmp/openclaw-auth-profiles-success", |
@@ -79,12 +78,14 @@ describe("markAuthProfileSuccess", () => {
|
79 | 78 | return lockedStore; |
80 | 79 | }); |
81 | 80 | |
| 81 | +const beforeUsed = Date.now(); |
82 | 82 | await markAuthProfileSuccess({ |
83 | 83 | store, |
84 | 84 | provider: "anthropic", |
85 | 85 | profileId: "anthropic:default", |
86 | 86 | agentDir: "/tmp/openclaw-auth-profiles-success", |
87 | 87 | }); |
| 88 | +const afterUsed = Date.now(); |
88 | 89 | |
89 | 90 | expect(storeMocks.saveAuthProfileStore).not.toHaveBeenCalled(); |
90 | 91 | expect(store.lastGood).toEqual({ anthropic: "anthropic:default" }); |
@@ -93,6 +94,10 @@ describe("markAuthProfileSuccess", () => {
|
93 | 94 | errorCount: 0, |
94 | 95 | cooldownUntil: undefined, |
95 | 96 | }); |
96 | | -expect(store.usageStats?.["anthropic:default"]?.lastUsed).toEqual(expect.any(Number)); |
| 97 | +const lastUsed = store.usageStats?.["anthropic:default"]?.lastUsed; |
| 98 | +expect(typeof lastUsed).toBe("number"); |
| 99 | +expect(Number.isFinite(lastUsed)).toBe(true); |
| 100 | +expect(lastUsed).toBeGreaterThanOrEqual(beforeUsed); |
| 101 | +expect(lastUsed).toBeLessThanOrEqual(afterUsed); |
97 | 102 | }); |
98 | 103 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。