test: tighten auth profile success timestamp assertion · openclaw/openclaw@ed9ff5b
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -246,12 +246,14 @@ describe("resolveAuthProfileOrder", () => {
|
246 | 246 | }; |
247 | 247 | saveAuthProfileStore(store, agentDir); |
248 | 248 | |
| 249 | +const beforeSuccess = Date.now(); |
249 | 250 | await markAuthProfileSuccess({ |
250 | 251 | store, |
251 | 252 | provider: "fixture-provider-plan", |
252 | 253 | profileId: "fixture-provider:default", |
253 | 254 | agentDir, |
254 | 255 | }); |
| 256 | +const afterSuccess = Date.now(); |
255 | 257 | |
256 | 258 | expect(store.lastGood).toEqual({ |
257 | 259 | "fixture-provider": "fixture-provider:default", |
@@ -261,7 +263,11 @@ describe("resolveAuthProfileOrder", () => {
|
261 | 263 | cooldownUntil: undefined, |
262 | 264 | cooldownReason: undefined, |
263 | 265 | }); |
264 | | -expect(store.usageStats?.["fixture-provider:default"]?.lastUsed).toEqual(expect.any(Number)); |
| 266 | +const lastUsed = store.usageStats?.["fixture-provider:default"]?.lastUsed; |
| 267 | +expect(typeof lastUsed).toBe("number"); |
| 268 | +expect(Number.isFinite(lastUsed)).toBe(true); |
| 269 | +expect(lastUsed).toBeGreaterThanOrEqual(beforeSuccess); |
| 270 | +expect(lastUsed).toBeLessThanOrEqual(afterSuccess); |
265 | 271 | } finally { |
266 | 272 | await rm(agentDir, { force: true, recursive: true }); |
267 | 273 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。