test: tighten signal autostart assertions · openclaw/openclaw@5044e7d
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -54,11 +54,8 @@ async function runMonitorWithMocks(opts: MonitorSignalProviderOptions) {
|
54 | 54 | |
55 | 55 | function expectWaitForTransportReadyTimeout(timeoutMs: number) { |
56 | 56 | expect(waitForTransportReadyMock).toHaveBeenCalledTimes(1); |
57 | | -expect(waitForTransportReadyMock).toHaveBeenCalledWith( |
58 | | -expect.objectContaining({ |
59 | | - timeoutMs, |
60 | | -}), |
61 | | -); |
| 57 | +const options = waitForTransportReadyMock.mock.calls[0]?.[0] as { timeoutMs?: number }; |
| 58 | +expect(options.timeoutMs).toBe(timeoutMs); |
62 | 59 | } |
63 | 60 | |
64 | 61 | describe("monitorSignalProvider autostart", () => { |
@@ -74,17 +71,22 @@ describe("monitorSignalProvider autostart", () => {
|
74 | 71 | }); |
75 | 72 | |
76 | 73 | expect(waitForTransportReadyMock).toHaveBeenCalledTimes(1); |
77 | | -expect(waitForTransportReadyMock).toHaveBeenCalledWith( |
78 | | -expect.objectContaining({ |
79 | | -label: "signal daemon", |
80 | | -timeoutMs: 30_000, |
81 | | -logAfterMs: 10_000, |
82 | | -logIntervalMs: 10_000, |
83 | | -pollIntervalMs: 150, |
84 | | - runtime, |
85 | | -abortSignal: expect.any(AbortSignal), |
86 | | -}), |
87 | | -); |
| 74 | +const options = waitForTransportReadyMock.mock.calls[0]?.[0] as { |
| 75 | +abortSignal?: unknown; |
| 76 | +check?: unknown; |
| 77 | +} & Record<string, unknown>; |
| 78 | +expect(options).toEqual({ |
| 79 | +label: "signal daemon", |
| 80 | +timeoutMs: 30_000, |
| 81 | +logAfterMs: 10_000, |
| 82 | +logIntervalMs: 10_000, |
| 83 | +pollIntervalMs: 150, |
| 84 | + runtime, |
| 85 | +abortSignal: options.abortSignal, |
| 86 | +check: options.check, |
| 87 | +}); |
| 88 | +expect(options.abortSignal).toBeInstanceOf(AbortSignal); |
| 89 | +expect(typeof options.check).toBe("function"); |
88 | 90 | }); |
89 | 91 | |
90 | 92 | it("uses startupTimeoutMs override when provided", async () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。