From d262bdfac16cb999ead7ba9ddc8f7989cbe5741e Mon Sep 17 00:00:00 2001 From: brennanb2025 Date: Mon, 22 Jun 2026 21:08:05 -0700 Subject: [PATCH] Fix multi-window merge test expectations Co-authored-by: Orca --- src/main/ipc/ssh.test.ts | 2 +- src/main/runtime/orca-runtime.test.ts | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/ipc/ssh.test.ts b/src/main/ipc/ssh.test.ts index ed03e968e4c..e4b55f86af8 100644 --- a/src/main/ipc/ssh.test.ts +++ b/src/main/ipc/ssh.test.ts @@ -482,7 +482,7 @@ describe('SSH IPC handlers', () => { reconnectAttempt: 0, remotePlatform: 'win32' }) - expect(mockWindow.webContents.send).toHaveBeenCalledWith('ssh:state-changed', { + expect(broadcastToMainWindowsMock).toHaveBeenCalledWith('ssh:state-changed', { targetId: 'ssh-1', state: { targetId: 'ssh-1', diff --git a/src/main/runtime/orca-runtime.test.ts b/src/main/runtime/orca-runtime.test.ts index 5d1734fd28e..9bb20942152 100644 --- a/src/main/runtime/orca-runtime.test.ts +++ b/src/main/runtime/orca-runtime.test.ts @@ -14302,6 +14302,7 @@ describe('OrcaRuntimeService', () => { terminalFitOverrideChanged: vi.fn(), terminalDriverChanged: vi.fn() }) + const webContents = { send: vi.fn() } const send = vi.fn((_channel: string, payload: { requestId: string }) => { runtime.syncWindowGraph(1, { tabs: [], @@ -14329,7 +14330,7 @@ describe('OrcaRuntimeService', () => { }) ipcMain.emit( 'terminal:tabCreateReply', - {}, + { sender: webContents }, { requestId: payload.requestId, tabId: 'tab-renderer', title: 'Terminal' } ) }) @@ -14337,8 +14338,9 @@ describe('OrcaRuntimeService', () => { runtime.syncWindowGraph(1, { tabs: [], leaves: [] }) electronMocks.BrowserWindow.fromId.mockReturnValue({ isDestroyed: () => false, - webContents: { send } + webContents }) + webContents.send = send const [first, second] = await Promise.all([ runtime.createMobileSessionTerminal(`id:${TEST_WORKTREE_ID}`, { @@ -14394,12 +14396,13 @@ describe('OrcaRuntimeService', () => { terminalFitOverrideChanged: vi.fn(), terminalDriverChanged: vi.fn() }) + const webContents = { send: vi.fn() } const send = vi.fn((_channel: string, payload: { requestId: string; worktreeId: string }) => { const parentTabId = payload.worktreeId === TEST_WORKTREE_ID ? 'tab-renderer-a' : 'tab-renderer-b' ipcMain.emit( 'terminal:tabCreateReply', - {}, + { sender: webContents }, { requestId: payload.requestId, tabId: parentTabId, title: 'Terminal' } ) }) @@ -14407,8 +14410,9 @@ describe('OrcaRuntimeService', () => { runtime.syncWindowGraph(1, { tabs: [], leaves: [] }) electronMocks.BrowserWindow.fromId.mockReturnValue({ isDestroyed: () => false, - webContents: { send } + webContents }) + webContents.send = send const firstCreate = runtime.createMobileSessionTerminal(`id:${TEST_WORKTREE_ID}`, { activate: false, @@ -14498,10 +14502,11 @@ describe('OrcaRuntimeService', () => { }) // Why: reply with a tabId but never sync a matching surface graph, so // waitForMobileTerminalSurface times out and the rollback path runs. + const webContents = { send: vi.fn() } const send = vi.fn((_channel: string, payload: { requestId: string }) => { ipcMain.emit( 'terminal:tabCreateReply', - {}, + { sender: webContents }, { requestId: payload.requestId, tabId: 'tab-ghost', title: 'Terminal' } ) }) @@ -14509,8 +14514,9 @@ describe('OrcaRuntimeService', () => { runtime.syncWindowGraph(1, { tabs: [], leaves: [] }) electronMocks.BrowserWindow.fromId.mockReturnValue({ isDestroyed: () => false, - webContents: { send } + webContents }) + webContents.send = send const pending = runtime.createMobileSessionTerminal(`id:${TEST_WORKTREE_ID}`, { activate: false