test: tighten cron event assertions · openclaw/openclaw@55b4fc8
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -35,10 +35,15 @@ describe("CronService interval/cron jobs fire on time", () => {
|
35 | 35 | enqueueSystemEvent: ReturnType<typeof vi.fn>, |
36 | 36 | expectedText: string, |
37 | 37 | ) => { |
38 | | -expect(enqueueSystemEvent).toHaveBeenCalledWith( |
39 | | -expectedText, |
40 | | -expect.objectContaining({ agentId: undefined }), |
41 | | -); |
| 38 | +const matchingCall = enqueueSystemEvent.mock.calls.find(([text]) => text === expectedText); |
| 39 | +if (!matchingCall) { |
| 40 | +throw new Error(`missing system event ${expectedText}`); |
| 41 | +} |
| 42 | +const options = matchingCall[1] as Record<string, unknown>; |
| 43 | +expect(options.agentId).toBeUndefined(); |
| 44 | +expect(options.sessionKey).toBeUndefined(); |
| 45 | +expect(typeof options.contextKey).toBe("string"); |
| 46 | +expect(String(options.contextKey).startsWith("cron:")).toBe(true); |
42 | 47 | }; |
43 | 48 | |
44 | 49 | const countMainSystemEvents = ( |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。