fix(voice-call): avoid blocking gateway startup · openclaw/openclaw@8e37ee4
steipete
·
2026-04-27
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -178,6 +178,32 @@ describe("voice-call plugin", () => {
|
178 | 178 | expect(respond).toHaveBeenCalledWith(true, { callId: "call-1", initiated: true }); |
179 | 179 | }); |
180 | 180 | |
| 181 | +it("does not block service startup while runtime exposure initializes", async () => { |
| 182 | +let resolveRuntime: ((runtime: VoiceCallRuntime) => void) | undefined; |
| 183 | +vi.mocked(createVoiceCallRuntime).mockReturnValueOnce( |
| 184 | +new Promise<VoiceCallRuntime>((resolve) => { |
| 185 | +resolveRuntime = resolve; |
| 186 | +}), |
| 187 | +); |
| 188 | +const { service, methods } = setup({ provider: "mock" }); |
| 189 | + |
| 190 | +expect(service).toBeDefined(); |
| 191 | +expect(service!.start(createServiceContext())).toBeUndefined(); |
| 192 | +expect(createVoiceCallRuntime).toHaveBeenCalledTimes(1); |
| 193 | + |
| 194 | +resolveRuntime?.(runtimeStub); |
| 195 | +const handler = methods.get("voicecall.initiate") as |
| 196 | +| ((ctx: { |
| 197 | +params: Record<string, unknown>; |
| 198 | +respond: ReturnType<typeof vi.fn>; |
| 199 | +}) => Promise<void>) |
| 200 | +| undefined; |
| 201 | +const respond = vi.fn(); |
| 202 | +await handler?.({ params: { message: "Hi" }, respond }); |
| 203 | + |
| 204 | +expect(respond).toHaveBeenCalledWith(true, { callId: "call-1", initiated: true }); |
| 205 | +}); |
| 206 | + |
181 | 207 | it("creates a fresh shared runtime after service stop", async () => { |
182 | 208 | const first = setup({ provider: "mock" }); |
183 | 209 | await first.service?.start(createServiceContext()); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。