



























@@ -52,9 +52,21 @@ async function runMonitorWithMocks(opts: MonitorSignalProviderOptions) {
5252});
5353}
545455+function requireWaitForTransportReadyOptions(): Record<string, unknown> {
56+const [call] = waitForTransportReadyMock.mock.calls;
57+if (!call) {
58+throw new Error("expected waitForTransportReady call");
59+}
60+const [options] = call;
61+if (!options || typeof options !== "object" || Array.isArray(options)) {
62+throw new Error("expected waitForTransportReady options");
63+}
64+return options as Record<string, unknown>;
65+}
66+5567function expectWaitForTransportReadyTimeout(timeoutMs: number) {
5668expect(waitForTransportReadyMock).toHaveBeenCalledTimes(1);
57-const options = waitForTransportReadyMock.mock.calls[0]?.[0] as { timeoutMs?: number };
69+const options = requireWaitForTransportReadyOptions();
5870expect(options.timeoutMs).toBe(timeoutMs);
5971}
6072@@ -71,10 +83,7 @@ describe("monitorSignalProvider autostart", () => {
7183});
72847385expect(waitForTransportReadyMock).toHaveBeenCalledTimes(1);
74-const options = waitForTransportReadyMock.mock.calls[0]?.[0] as {
75-abortSignal?: unknown;
76-check?: unknown;
77-} & Record<string, unknown>;
86+const options = requireWaitForTransportReadyOptions();
7887expect(options).toEqual({
7988label: "signal daemon",
8089timeoutMs: 30_000,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。