test: guard voice call test lookups · openclaw/openclaw@afac148
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -576,7 +576,9 @@ describe("MediaStreamHandler security hardening", () => {
|
576 | 576 | throw new Error("Expected websocket connection emit call"); |
577 | 577 | } |
578 | 578 | expect(emitCall[0]).toBe("connection"); |
579 | | -expect(emitCall[1]).toBeDefined(); |
| 579 | +if (!emitCall[1]) { |
| 580 | +throw new Error("Expected websocket connection argument"); |
| 581 | +} |
580 | 582 | const request = requireRecord(emitCall[2], "connection request"); |
581 | 583 | const socket = requireRecord(request.socket, "connection request socket"); |
582 | 584 | expect(socket.remoteAddress).toBe("127.0.0.1"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -269,9 +269,11 @@ describe("generateVoiceResponse", () => {
|
269 | 269 | expect(resolveAgentWorkspaceDir).toHaveBeenCalledWith(coreConfig, "main"); |
270 | 270 | expect(resolveAgentIdentity).toHaveBeenCalledWith(coreConfig, "main"); |
271 | 271 | const defaultSessionEntry = sessionStore["voice:15550001111"]; |
272 | | -expect(defaultSessionEntry).toBeDefined(); |
| 272 | +if (!defaultSessionEntry) { |
| 273 | +throw new Error("Expected default voice session entry"); |
| 274 | +} |
273 | 275 | expect(resolveSessionFilePath).toHaveBeenCalledWith( |
274 | | -defaultSessionEntry?.sessionId, |
| 276 | +defaultSessionEntry.sessionId, |
275 | 277 | defaultSessionEntry, |
276 | 278 | { |
277 | 279 | agentId: "main", |
@@ -317,9 +319,11 @@ describe("generateVoiceResponse", () => {
|
317 | 319 | expect(resolveAgentWorkspaceDir).toHaveBeenCalledWith(coreConfig, "voice"); |
318 | 320 | expect(resolveAgentIdentity).toHaveBeenCalledWith(coreConfig, "voice"); |
319 | 321 | const voiceSessionEntry = sessionStore["voice:15550001111"]; |
320 | | -expect(voiceSessionEntry).toBeDefined(); |
| 322 | +if (!voiceSessionEntry) { |
| 323 | +throw new Error("Expected routed voice session entry"); |
| 324 | +} |
321 | 325 | expect(resolveSessionFilePath).toHaveBeenCalledWith( |
322 | | -voiceSessionEntry?.sessionId, |
| 326 | +voiceSessionEntry.sessionId, |
323 | 327 | voiceSessionEntry, |
324 | 328 | { |
325 | 329 | agentId: "voice", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。