Files
hapi/web/src/hooks/useCodexExplorationCollapse.test.ts
T
wushenghua 7a8332ce14 feat(web): configure Codex exploration collapse
Default Codex exploration groups to collapsed and expose a persisted chat setting for users who prefer them expanded.\n\nvia [HAPI](https://hapi.run)\n\nCo-Authored-By: HAPI <noreply@hapi.run>
2026-08-03 21:03:30 +08:00

24 lines
864 B
TypeScript

import { beforeEach, describe, expect, it } from 'vitest'
import {
DEFAULT_CODEX_EXPLORATION_COLLAPSED,
getInitialCodexExplorationCollapsed,
} from './useCodexExplorationCollapse'
describe('useCodexExplorationCollapse helpers', () => {
beforeEach(() => {
window.localStorage.clear()
})
it('defaults to collapsed', () => {
expect(getInitialCodexExplorationCollapsed()).toBe(DEFAULT_CODEX_EXPLORATION_COLLAPSED)
})
it('reads valid stored values and ignores invalid values', () => {
window.localStorage.setItem('hapi-codex-exploration-collapsed', 'false')
expect(getInitialCodexExplorationCollapsed()).toBe(false)
window.localStorage.setItem('hapi-codex-exploration-collapsed', 'invalid')
expect(getInitialCodexExplorationCollapsed()).toBe(DEFAULT_CODEX_EXPLORATION_COLLAPSED)
})
})