The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
import { describe, expect, it } from 'vitest'
import { NEW_CHAT_ROUTE, primaryRouteSelectedSessionId, sessionRoute, SETTINGS_ROUTE } from './routes'
const SESS_A = 'sess-a'
const SESS_B = 'sess-b'
describe('primaryRouteSelectedSessionId', () => {
it('prefers the routed session id over a stale/different store selection (#59305)', () => {
// The route already committed to B while the store selection hasn't
// caught up yet (still reads A) — the route wins.
expect(primaryRouteSelectedSessionId(sessionRoute(SESS_B), SESS_A)).toBe(SESS_B)
})
it('returns null on the new-chat route even with a leftover selection from the previous chat', () => {
expect(primaryRouteSelectedSessionId(NEW_CHAT_ROUTE, SESS_A)).toBeNull()
})
it('falls back to the store selection on a non-chat route (settings, overlays)', () => {
expect(primaryRouteSelectedSessionId(SETTINGS_ROUTE, SESS_A)).toBe(SESS_A)
})
})