mirror of
https://github.com/stablyai/orca.git
synced 2026-11-04 02:57:36 +00:00
* feat(chat): support structured clear and compact commands * fix(chat): authorize mobile commands and bound clear-chain projection * fix(chat): localize conversation command send errors * fix(chat): retain clear pane identity with reopened history * test: account for combined structured session RPC additions --------- Co-authored-by: Merge Sim <sim@local>
61 lines
2.0 KiB
TypeScript
61 lines
2.0 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import type { RuntimeMobileSessionTabsSnapshot } from '../../shared/runtime-types'
|
|
import { replaceConversationInSnapshot } from './structured-conversation-tab-replacement'
|
|
|
|
describe('conversation pane replacement', () => {
|
|
const snapshot: RuntimeMobileSessionTabsSnapshot = {
|
|
worktree: 'folder',
|
|
publicationEpoch: 'epoch',
|
|
snapshotVersion: 4,
|
|
activeGroupId: 'right',
|
|
activeTabId: 'old-tab',
|
|
activeTabType: 'agent-session',
|
|
tabs: [
|
|
{
|
|
type: 'agent-session',
|
|
id: 'old-tab',
|
|
sessionId: 'old-session',
|
|
agent: 'claude',
|
|
title: 'Old title',
|
|
isActive: true,
|
|
isPinned: true
|
|
}
|
|
],
|
|
tabGroups: [
|
|
{ id: 'right', tabOrder: ['old-tab'], activeTabId: 'old-tab', recentTabIds: ['old-tab'] }
|
|
]
|
|
}
|
|
const replacement = {
|
|
workspaceId: 'folder',
|
|
sourceSessionId: 'old-session',
|
|
sessionId: 'new-session',
|
|
agent: 'claude' as const
|
|
}
|
|
it('preserves group, position, selection and pinning while resetting identity/title', () => {
|
|
const result = replaceConversationInSnapshot(snapshot, replacement)
|
|
expect(result).toMatchObject({
|
|
publicationEpoch: 'epoch',
|
|
snapshotVersion: 5,
|
|
activeGroupId: 'right',
|
|
activeTabId: 'agent-session:new-session'
|
|
})
|
|
expect(result.tabs[0]).toMatchObject({
|
|
sessionId: 'new-session',
|
|
title: 'Claude Chat',
|
|
replacesSessionId: 'old-session',
|
|
isPinned: true
|
|
})
|
|
expect(result.tabGroups?.[0]).toMatchObject({
|
|
tabOrder: ['agent-session:new-session'],
|
|
recentTabIds: ['agent-session:new-session']
|
|
})
|
|
expect(snapshot.tabs[0]).toMatchObject({ sessionId: 'old-session' })
|
|
expect(replaceConversationInSnapshot(result, replacement)).toBe(result)
|
|
})
|
|
it('does not touch another workspace', () => {
|
|
expect(
|
|
replaceConversationInSnapshot(snapshot, { ...replacement, workspaceId: 'elsewhere' })
|
|
).toBe(snapshot)
|
|
})
|
|
})
|