mirror of
https://github.com/stablyai/orca.git
synced 2026-10-22 16:03:47 +00:00
test(renderer): assert parked-pane remount on the runtime-active repos:changed path
The local-slice refresh 13632 introduces still has to release panes parked on an unhydrated host; the prior test stubbed the remount but never asserted it. Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -10281,7 +10281,6 @@ describe('runtime host catalog refresh on reposChanged', () => {
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
describe('repo catalog refresh on repos:changed', () => {
|
||||
it('skips remote catalog RPCs when refreshing local rows under a runtime', async () => {
|
||||
vi.resetModules()
|
||||
@@ -10289,15 +10288,16 @@ describe('repo catalog refresh on repos:changed', () => {
|
||||
const fetchRepos = vi.fn(() => Promise.resolve())
|
||||
const fetchProjectGroups = vi.fn(() => Promise.resolve())
|
||||
const fetchFolderWorkspaces = vi.fn(() => Promise.resolve())
|
||||
const remountTerminalTabForRecovery = vi.fn(() => true)
|
||||
const state = {
|
||||
settings: { activeRuntimeEnvironmentId: null as string | null },
|
||||
repos: [],
|
||||
worktreesByRepo: {},
|
||||
repos: [{ id: 'repo1', connectionId: 'conn-1' }],
|
||||
worktreesByRepo: { repo1: [{ id: 'wt-1', repoId: 'repo1' }] },
|
||||
folderWorkspaces: [],
|
||||
projectGroups: [],
|
||||
tabsByWorktree: {},
|
||||
tabsByWorktree: { 'wt-1': [{ id: 'tab-1', ptyId: null }] },
|
||||
ptyIdsByTabId: {},
|
||||
remountTerminalTabForRecovery: vi.fn(),
|
||||
remountTerminalTabForRecovery,
|
||||
fetchRepos,
|
||||
fetchProjectGroups,
|
||||
fetchFolderWorkspaces
|
||||
@@ -10337,18 +10337,24 @@ describe('repo catalog refresh on repos:changed', () => {
|
||||
)
|
||||
vi.stubGlobal('window', { api })
|
||||
|
||||
const { recordTerminalTabParkedOnUnresolvedHost, clearTerminalTabsParkedOnUnresolvedHost } =
|
||||
await import('@/lib/parked-terminal-host-hydration')
|
||||
clearTerminalTabsParkedOnUnresolvedHost()
|
||||
|
||||
const { useIpcEvents } = await import('./useIpcEvents')
|
||||
useIpcEvents()
|
||||
state.settings.activeRuntimeEnvironmentId = 'env-1'
|
||||
// Why: the local-slice refresh still has to release panes that parked on an unhydrated host.
|
||||
recordTerminalTabParkedOnUnresolvedHost('wt-1', 'tab-1')
|
||||
reposChangedListener?.()
|
||||
await Promise.resolve()
|
||||
await Promise.resolve()
|
||||
await Promise.resolve()
|
||||
await new Promise((resolve) => setTimeout(resolve, 0))
|
||||
|
||||
const localOwner = { runtimeEnvironmentId: null }
|
||||
expect(fetchRepos).toHaveBeenCalledWith(localOwner)
|
||||
expect(fetchProjectGroups).toHaveBeenCalledWith(localOwner)
|
||||
expect(fetchFolderWorkspaces).toHaveBeenCalledWith(localOwner)
|
||||
expect(remountTerminalTabForRecovery).toHaveBeenCalledWith('tab-1')
|
||||
clearTerminalTabsParkedOnUnresolvedHost()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user