test: guard voice call test lookups

This commit is contained in:
Peter Steinberger
2026-05-11 19:22:56 +01:00
parent 22657f598e
commit afac1486bf
2 changed files with 11 additions and 5 deletions

View File

@@ -576,7 +576,9 @@ describe("MediaStreamHandler security hardening", () => {
throw new Error("Expected websocket connection emit call");
}
expect(emitCall[0]).toBe("connection");
expect(emitCall[1]).toBeDefined();
if (!emitCall[1]) {
throw new Error("Expected websocket connection argument");
}
const request = requireRecord(emitCall[2], "connection request");
const socket = requireRecord(request.socket, "connection request socket");
expect(socket.remoteAddress).toBe("127.0.0.1");

View File

@@ -269,9 +269,11 @@ describe("generateVoiceResponse", () => {
expect(resolveAgentWorkspaceDir).toHaveBeenCalledWith(coreConfig, "main");
expect(resolveAgentIdentity).toHaveBeenCalledWith(coreConfig, "main");
const defaultSessionEntry = sessionStore["voice:15550001111"];
expect(defaultSessionEntry).toBeDefined();
if (!defaultSessionEntry) {
throw new Error("Expected default voice session entry");
}
expect(resolveSessionFilePath).toHaveBeenCalledWith(
defaultSessionEntry?.sessionId,
defaultSessionEntry.sessionId,
defaultSessionEntry,
{
agentId: "main",
@@ -317,9 +319,11 @@ describe("generateVoiceResponse", () => {
expect(resolveAgentWorkspaceDir).toHaveBeenCalledWith(coreConfig, "voice");
expect(resolveAgentIdentity).toHaveBeenCalledWith(coreConfig, "voice");
const voiceSessionEntry = sessionStore["voice:15550001111"];
expect(voiceSessionEntry).toBeDefined();
if (!voiceSessionEntry) {
throw new Error("Expected routed voice session entry");
}
expect(resolveSessionFilePath).toHaveBeenCalledWith(
voiceSessionEntry?.sessionId,
voiceSessionEntry.sessionId,
voiceSessionEntry,
{
agentId: "voice",