From 3e29504ca31ae422375863f801ed3c9b529a84c3 Mon Sep 17 00:00:00 2001 From: James Feng <47167674+GhostDragon124@users.noreply.github.com> Date: Sun, 7 Jun 2026 03:43:13 +0800 Subject: [PATCH] fix: replace mockModulePreservingExports with mock.module for tsc compat --- src/services/acp/__tests__/agent.test.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/services/acp/__tests__/agent.test.ts b/src/services/acp/__tests__/agent.test.ts index 6b9b33721..9a1156ce6 100644 --- a/src/services/acp/__tests__/agent.test.ts +++ b/src/services/acp/__tests__/agent.test.ts @@ -30,9 +30,13 @@ mock.module('src/utils/config.ts', () => ({ enableConfigs: mock(() => {}), })) +const mockSwitchSession = mock(() => {}) + mock.module('../../../bootstrap/state.js', () => ({ setOriginalCwd: mock(() => {}), addSlowOperation: mock(() => {}), + switchSession: mockSwitchSession, + getSessionProjectDir: mock(() => null), })) const mockGetDefaultAppState = mock(() => ({ @@ -87,9 +91,9 @@ const mockResolveSessionFilePath = mock(async () => ({ projectPath: '/tmp', fileSize: 100, })) -mockModulePreservingExports('../../../utils/sessionStoragePortable.js', { +mock.module('../../../utils/sessionStoragePortable.js', () => ({ resolveSessionFilePath: mockResolveSessionFilePath, -}) +})) const mockGetMainLoopModel = mock(() => 'claude-sonnet-4-6') @@ -755,7 +759,6 @@ describe('AcpAgent', () => { expect(commit.input).toEqual({ hint: '[message]' }) }) }) - }) describe('sessionId alignment with global state', () => { test('newSession calls switchSession with the generated sessionId', async () => {