test(agent-hooks): cover settings reconciliation

This commit is contained in:
Brennan Benson
2026-07-29 18:50:09 -07:00
parent e14028c04f
commit a64cf4ca96
+26
View File
@@ -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<unknown>
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 })