test: dedupe nodes pending mock reads · openclaw/openclaw@29ba6f8
steipete
·
2026-05-13
·
via Recent Commits to openclaw:main
File tree
src/gateway/server-methods
| Original file line number | Diff line number | Diff line change |
|---|
@@ -46,6 +46,10 @@ function makeContext(overrides?: Partial<Record<string, unknown>>) {
|
46 | 46 | }; |
47 | 47 | } |
48 | 48 | |
| 49 | +function respondCall(respond: ReturnType<typeof vi.fn>): RespondCall | undefined { |
| 50 | +return respond.mock.calls[0] as RespondCall | undefined; |
| 51 | +} |
| 52 | + |
49 | 53 | describe("node.pending handlers", () => { |
50 | 54 | beforeEach(() => { |
51 | 55 | mocks.drainNodePendingWork.mockReset(); |
@@ -100,7 +104,7 @@ describe("node.pending handlers", () => {
|
100 | 104 | isWebchatConnect: () => false, |
101 | 105 | }); |
102 | 106 | |
103 | | -const call = respond.mock.calls.at(0) as RespondCall | undefined; |
| 107 | +const call = respondCall(respond); |
104 | 108 | expect(call?.[0]).toBe(false); |
105 | 109 | expect(call?.[2]?.message).toContain("connected device identity"); |
106 | 110 | }); |
@@ -166,7 +170,7 @@ describe("node.pending handlers", () => {
|
166 | 170 | timeoutMs: 3_000, |
167 | 171 | }); |
168 | 172 | expect(mocks.maybeSendNodeWakeNudge).not.toHaveBeenCalled(); |
169 | | -const call = respond.mock.calls.at(0) as |
| 173 | +const call = respondCall(respond) as |
170 | 174 | | [boolean, { nodeId?: string; revision?: number; wakeTriggered?: boolean }, unknown?] |
171 | 175 | | undefined; |
172 | 176 | expect(call?.[0]).toBe(true); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。