Files
orca/src/shared/pairing-local-ui-fields.test.ts
T
Jinjing 9fed61e5c2 Persist agents sidebar search visibility as pairing-local preference (#19313)
* Persist agents sidebar search field visibility as pairing-local preferen

- Add `agentsShowSearch` to workspace UI state with default on
- Include in pairing-local fields so preference syncs across clients
- Convert search from menu action to checkbox menu item for explicit toggle
- Update activity thread options menu to reflect checkbox state
- Add localization strings across all supported languages
- Update RPC schemas and preference persistence layer
- Includes readiness validation reports confirming feature is clean

* rm review

* fix documentation
2026-09-07 11:27:40 -07:00

51 lines
1.8 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { omitPairingLocalUiFields, PAIRING_LOCAL_UI_FIELDS } from './pairing-local-ui-fields'
describe('pairing-local UI fields', () => {
// Why a census: the seams that honor this set are spread across the host RPC and the web
// preload, so a field added here without wiring every seam would otherwise ship silently.
it('census: the set is exactly the fields no pairing may exchange', () => {
expect([...PAIRING_LOCAL_UI_FIELDS]).toEqual([
'automationHostFilter',
'hideWorkspacesFromOtherDevices',
'manualRepoOrder',
'workspaceHostOrder',
'agentsVisibleHostIds',
'agentsFilterRepoIds',
'agentsShowChildAgents',
'agentsCompactMode',
'agentsShowSearch',
'agentsReadFilter',
'agentsGroupBy',
'activityClearedAtByPaneKey',
'manuallyUnreadTurnsByPaneKey'
])
})
it('omits every member and keeps everything else', () => {
const state = {
hideWorkspacesFromOtherDevices: true,
manualRepoOrder: [{ hostId: 'local' as const, repoId: 'repo-a' }],
workspaceHostOrder: ['local' as const],
sidebarWidth: 280,
activeView: 'tasks' as const
}
expect(omitPairingLocalUiFields(state)).toEqual({ sidebarWidth: 280, activeView: 'tasks' })
})
it('leaves a payload that carries no member untouched', () => {
const state = { sidebarWidth: 280 }
expect(omitPairingLocalUiFields(state)).toEqual(state)
})
// A member explicitly set to undefined must still be removed, not forwarded as a present key
// that a receiver would read as "cleared".
it('drops a member present with an undefined value', () => {
expect(
Object.keys(omitPairingLocalUiFields({ manualRepoOrder: undefined, sidebarWidth: 280 }))
).toEqual(['sidebarWidth'])
})
})