test: tighten task maintenance recovery timestamp assertion · openclaw/openclaw@c9f3b09
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -561,6 +561,7 @@ describe("task-registry maintenance issue #60299", () => {
|
561 | 561 | tryRecoverTaskBeforeMarkLost: recoveryHook, |
562 | 562 | }); |
563 | 563 | |
| 564 | +const beforeMaintenance = Date.now(); |
564 | 565 | expect(previewTaskRegistryMaintenance()).toMatchObject({ reconciled: 1, recovered: 0 }); |
565 | 566 | const result = await runTaskRegistryMaintenance(); |
566 | 567 | expect(result).toMatchObject({ reconciled: 0, recovered: 1 }); |
@@ -570,8 +571,14 @@ describe("task-registry maintenance issue #60299", () => {
|
570 | 571 | taskId: task.taskId, |
571 | 572 | runtime: "cron", |
572 | 573 | task: expect.objectContaining({ taskId: task.taskId }), |
573 | | -now: expect.any(Number), |
574 | 574 | }), |
575 | 575 | ); |
| 576 | +const hookCalls = recoveryHook.mock.calls as unknown as Array<[params: { now?: unknown }]>; |
| 577 | +const hookNow = hookCalls[0]?.[0]?.now; |
| 578 | +expect(typeof hookNow).toBe("number"); |
| 579 | +if (typeof hookNow !== "number") { |
| 580 | +throw new Error("Expected task recovery hook now timestamp"); |
| 581 | +} |
| 582 | +expect(hookNow).toBeGreaterThanOrEqual(beforeMaintenance); |
576 | 583 | }); |
577 | 584 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。