Skip to content

Commit a017d11

Browse files
committed
test(voice-call): build outcome rows without spread
Keep each outcome fixture intact and return the asynchronous row or the asynchronous/synchronous pair explicitly. This satisfies no-map-spread without changing the 29-case matrix or production behavior.
1 parent a39bf40 commit a017d11

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

‎extensions/voice-call/src/webhook/realtime-handler.test.ts‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,13 +1785,14 @@ describe("RealtimeCallHandler path routing", () => {
17851785
{ label: "returned timeout", result: { text: "The run timed out.", timedOut: true } },
17861786
];
17871787
it.each(
1788-
outcomes.flatMap((outcome) => [
1789-
{ ...outcome, synchronous: false },
1790-
...(path === "general" && "error" in outcome
1791-
? [{ ...outcome, synchronous: true, label: `synchronous ${outcome.label}` }]
1792-
: []),
1793-
]),
1794-
)("projects $label once per provider call while the phone stays open", async (outcome) => {
1788+
outcomes.flatMap((outcome) => {
1789+
const asynchronous = { outcome, synchronous: false, label: outcome.label };
1790+
return path === "general" && "error" in outcome
1791+
? [asynchronous, { outcome, synchronous: true, label: `synchronous ${outcome.label}` }]
1792+
: [asynchronous];
1793+
}),
1794+
)("projects $label once per provider call while the phone stays open", async (testCase) => {
1795+
const { outcome, synchronous } = testCase;
17951796
let callbacks: RealtimeBridgeRequest | undefined;
17961797
const submitToolResult = vi.fn();
17971798
const sendUserMessage = vi.fn();
@@ -1815,7 +1816,7 @@ describe("RealtimeCallHandler path routing", () => {
18151816
);
18161817
const pending = createDeferred<unknown>();
18171818
const hostTool = vi.fn((_args: unknown, _callId: string, _context: ToolHandlerContext) => {
1818-
if (outcome.synchronous && "error" in outcome) {
1819+
if (synchronous && "error" in outcome) {
18191820
throw outcome.error;
18201821
}
18211822
return pending.promise;
@@ -1853,7 +1854,7 @@ describe("RealtimeCallHandler path routing", () => {
18531854
path === "general" ? undefined : false,
18541855
);
18551856

1856-
if ("error" in outcome && !outcome.synchronous) {
1857+
if ("error" in outcome && !synchronous) {
18571858
pending.reject(outcome.error);
18581859
} else {
18591860
pending.resolve(outcome.result);

0 commit comments

Comments
 (0)