fix(desktop): pin that the cold-start restore announces the session the pre-session draft moves onto
The hook test drove announceNewSessionDraftKey by hand, so reverting the restore's announce sites kept every test green. Stash a __new__ draft, let the remembered-route restore run, and require the composer's adoption to succeed for the restored key.
This commit is contained in:
@@ -3,6 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
import { setApiRequestConnection, setApiRequestProfile } from '@/hermes'
|
||||
import { createClientSessionState } from '@/lib/chat-runtime'
|
||||
import { adoptNewSessionDraft, stashSessionDraft, takeSessionDraft } from '@/store/composer'
|
||||
import { $confirmRequest, runConfirm, settleConfirm } from '@/store/confirm'
|
||||
import { $hubInstalledOverride } from '@/store/hub-actions'
|
||||
import { requestMcpInstallFromDeepLink } from '@/store/mcp-deeplink-install'
|
||||
@@ -171,6 +172,19 @@ describe('useDesktopIntegrations', () => {
|
||||
expect(navigate).toHaveBeenCalledWith('/remembered-session', { replace: true })
|
||||
})
|
||||
|
||||
it('announces the restored session so the pre-session draft follows the cold-start navigation', () => {
|
||||
window.localStorage.setItem('hermes.desktop.lastRoute.profile.default', '/remembered-session')
|
||||
// Typed on the fresh chat while the backend was still coming up.
|
||||
stashSessionDraft(null, 'typed while booting', [])
|
||||
|
||||
render({ profileReady: true, sessions: [session({ id: 'remembered-session', profile: 'default' })] })
|
||||
|
||||
expect(navigate).toHaveBeenCalledWith('/remembered-session', { replace: true })
|
||||
// The composer's scope swap may only carry the draft when the restore announced this key.
|
||||
expect(adoptNewSessionDraft('remembered-session')).toBe(true)
|
||||
expect(takeSessionDraft('remembered-session').text).toBe('typed while booting')
|
||||
})
|
||||
|
||||
it('waits for sessions before validating a remembered session route', () => {
|
||||
window.localStorage.setItem('hermes.desktop.lastRoute.profile.default', '/remembered-session')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user