mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
- fetch picker sessions only while the dialog is open - list all-projects sessions with one request per page - block infinite-scroll paging while a search is pending - memoize picker rows with stable callbacks - remove deleted sessions from list caches instead of refetching - keep the repo tab when the open session is deleted - reuse useSessionSearch in the sidebar session tree - drop dead activeSessionID/isActive and share delete, session-key and repo-map helpers - move usePersistentBoolean to its own hook
21 lines
644 B
TypeScript
21 lines
644 B
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { buildPinnedSessionKeys, getSessionKey } from './sessionKey'
|
|
import type { Session } from '@/api/types'
|
|
|
|
describe('getSessionKey', () => {
|
|
it('combines the session directory and id', () => {
|
|
const session = { id: 'ses_1', location: { directory: '/w/a' } } as Session
|
|
|
|
expect(getSessionKey(session)).toBe('/w/a:ses_1')
|
|
})
|
|
})
|
|
|
|
describe('buildPinnedSessionKeys', () => {
|
|
it('builds a session key for each pin', () => {
|
|
const keys = buildPinnedSessionKeys([{ directory: '/a', sessionId: 's1' }])
|
|
|
|
expect(keys.has('/a:s1')).toBe(true)
|
|
expect(keys.size).toBe(1)
|
|
})
|
|
})
|