From a64cf4ca96bb2efd22aed11e88de132dfe7dc767 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Wed, 29 Jul 2026 18:50:09 -0700 Subject: [PATCH] test(agent-hooks): cover settings reconciliation --- src/main/ipc/settings.test.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main/ipc/settings.test.ts b/src/main/ipc/settings.test.ts index 11d6b7c93d0..f91c6699850 100644 --- a/src/main/ipc/settings.test.ts +++ b/src/main/ipc/settings.test.ts @@ -149,6 +149,32 @@ describe('registerSettingsHandlers', () => { expect(applyAgentStatusHooksEnabledMock).not.toHaveBeenCalled() }) + it('reconciles hooks when the disabled-agent set changes', async () => { + const before = { + agentStatusHooksEnabled: true, + disabledTuiAgents: ['codex', 'claude'] + } + const updated = { + ...before, + disabledTuiAgents: ['claude'] + } + store.getSettings.mockReturnValue(before) + store.updateSettings.mockReturnValue(updated) + registerSettingsHandlers(store as never) + const handler = handleMock.mock.calls.find((call) => call[0] === 'settings:set')?.[1] as ( + event: typeof settingsInvokeEvent, + args: { disabledTuiAgents: string[] } + ) => Promise + + await handler(settingsInvokeEvent, { disabledTuiAgents: ['claude'] }) + + expect(applyAgentStatusHooksEnabledMock).toHaveBeenCalledWith( + true, + updated, + expect.objectContaining({ shouldContinue: expect.any(Function) }) + ) + }) + it('rejects durable Active Server writes through generic settings:set', async () => { store.getSettings.mockReturnValue({ activeRuntimeEnvironmentId: null }) store.updateSettings.mockReturnValue({ activeRuntimeEnvironmentId: null })