fix: replace mockModulePreservingExports with mock.module for tsc compat

This commit is contained in:
James Feng 2026-06-07 03:43:13 +08:00
parent e0382ce2d4
commit 3e29504ca3

View File

@ -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 () => {