mirror of
https://github.com/stablyai/orca.git
synced 2026-10-22 00:03:47 +00:00
* Show all worktrees across all hosts on mobile Avoid honoring desktop's host-filtering settings since mobile lacks the UI to manage or unhide them. This prevents worktrees from being silently hidden under certain host scopes. Additionally, this removes worktree filtering based on repo metadata, which previously caused worktrees to vanish when same-named repos on different hosts collapsed to a single ID. * fix(daemon): preserve promisify.custom type through wrapChildProcessApi The windows-hidden-console-children test (from #7499, admin-merged with a failing verify) failed tsgo: promisify(wrapped) resolved to its zero-arg overload because the wrapper erased its argument to a bare variadic function and the fake never statically carried promisify.custom. Preserve the wrapped type via a generic overload (accurate: the wrapper copies the call signature and symbols verbatim) and build the fake as a real CustomPromisify, so promisify routes through the custom overload as it does in production. Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Orca <help@stably.ai>
86 lines
2.8 KiB
TypeScript
86 lines
2.8 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { DEFAULT_MOBILE_WORKSPACE_STATUSES } from './mobile-workspace-statuses'
|
|
import {
|
|
applyDesktopViewSettings,
|
|
groupModeFromDesktop,
|
|
groupModeToDesktop,
|
|
sortModeFromDesktop,
|
|
type MobileViewState,
|
|
type WorkspaceViewSettings
|
|
} from './workspace-view-settings'
|
|
|
|
const base: MobileViewState = {
|
|
groupMode: 'repo',
|
|
sortMode: 'recent',
|
|
hideSleeping: false,
|
|
hideDefaultBranch: false,
|
|
filterRepoIds: [],
|
|
collapsedGroups: [],
|
|
workspaceStatuses: DEFAULT_MOBILE_WORKSPACE_STATUSES
|
|
}
|
|
|
|
describe('group mode mapping', () => {
|
|
it('round-trips every mobile group mode through the desktop value', () => {
|
|
for (const mode of ['none', 'workspaceStatus', 'repo', 'prStatus'] as const) {
|
|
expect(groupModeFromDesktop(groupModeToDesktop(mode))).toBe(mode)
|
|
}
|
|
})
|
|
|
|
it('maps the desktop kebab-case values back to mobile', () => {
|
|
expect(groupModeFromDesktop('workspace-status')).toBe('workspaceStatus')
|
|
expect(groupModeFromDesktop('pr-status')).toBe('prStatus')
|
|
expect(groupModeFromDesktop(undefined)).toBeNull()
|
|
})
|
|
})
|
|
|
|
describe('sort mode mapping', () => {
|
|
it('accepts shared sort values and rejects unknown', () => {
|
|
expect(sortModeFromDesktop('manual')).toBe('manual')
|
|
expect(sortModeFromDesktop('smart')).toBe('smart')
|
|
expect(sortModeFromDesktop(undefined)).toBeNull()
|
|
expect(sortModeFromDesktop('bogus' as never)).toBeNull()
|
|
})
|
|
})
|
|
|
|
describe('applyDesktopViewSettings', () => {
|
|
it('applies provided desktop fields and leaves missing ones untouched', () => {
|
|
const next = applyDesktopViewSettings(base, {
|
|
groupBy: 'pr-status',
|
|
hideSleepingWorkspaces: true,
|
|
filterRepoIds: ['repo-1']
|
|
})
|
|
expect(next).toEqual({
|
|
...base,
|
|
groupMode: 'prStatus',
|
|
hideSleeping: true,
|
|
filterRepoIds: ['repo-1']
|
|
})
|
|
})
|
|
|
|
it('keeps current values when the desktop payload is empty', () => {
|
|
expect(applyDesktopViewSettings(base, {})).toEqual(base)
|
|
})
|
|
|
|
it('keeps renderable workspace statuses when desktop sends an empty catalog', () => {
|
|
const next = applyDesktopViewSettings(base, { workspaceStatuses: [] })
|
|
|
|
expect(next.workspaceStatuses).toBe(DEFAULT_MOBILE_WORKSPACE_STATUSES)
|
|
})
|
|
|
|
it('ignores desktop workspace host scope so mobile always shows all hosts', () => {
|
|
// Mobile has no host-scope UI; honoring the synced scope would silently hide
|
|
// workspaces the user cannot unhide. See mobile-show-all-workspace.
|
|
const next = applyDesktopViewSettings(base, {
|
|
workspaceHostScope: 'runtime:devbox',
|
|
visibleWorkspaceHostIds: ['local']
|
|
} as unknown as WorkspaceViewSettings)
|
|
|
|
expect(next).toEqual(base)
|
|
})
|
|
|
|
it('ignores an unrecognized groupBy rather than blanking the mode', () => {
|
|
const next = applyDesktopViewSettings(base, { groupBy: 'mystery' as never })
|
|
expect(next.groupMode).toBe('repo')
|
|
})
|
|
})
|