mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
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>
24 lines
864 B
TypeScript
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)
|
|
})
|
|
})
|