test: remove 30 low-value cases and seven suites (#34120)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-10-26 16:08:54 -07:00
committed by GitHub
co-authored by OrcaWin
parent 22185818c8
commit ebeb677943
15 changed files with 1 additions and 468 deletions
-7
View File
@@ -8738,7 +8738,6 @@
"src/renderer/src/components/settings/BrowserPane.search-catalog.test.tsx": 588,
"src/renderer/src/components/settings/BrowserPane.test.ts": 35,
"src/renderer/src/components/settings/BrowserSitePermissionsSetting.test.tsx": 378,
"src/renderer/src/components/settings/BrowserSshWorkspaceRoutingSetting.test.tsx": 680,
"src/renderer/src/components/settings/BrowserUseSkillStep.plan-status.test.tsx": 6354,
"src/renderer/src/components/settings/BrowserUseSkillStep.test.tsx": 165,
"src/renderer/src/components/settings/BrowserUserAgentSetting.test.tsx": 2731,
@@ -8808,7 +8807,6 @@
"src/renderer/src/components/settings/ReleaseBuildPicker.test.tsx": 714,
"src/renderer/src/components/settings/ReleaseChannelSection.test.tsx": 2427,
"src/renderer/src/components/settings/RemoteServerUpdateDialog.test.tsx": 333,
"src/renderer/src/components/settings/RemoteServerUpdateStatus.test.ts": 62,
"src/renderer/src/components/settings/RepositoryGitHubAccountSection.inventory-lifetime.test.tsx": 587,
"src/renderer/src/components/settings/RepositoryGitHubAccountSection.test.tsx": 662,
"src/renderer/src/components/settings/RepositoryPane.test.ts": 2778,
@@ -8887,7 +8885,6 @@
"src/renderer/src/components/settings/general-editor-search.test.ts": 136,
"src/renderer/src/components/settings/general-preview-tab-search.test.ts": 136,
"src/renderer/src/components/settings/git-description-templates.test.tsx": 1759,
"src/renderer/src/components/settings/host-scoped-setting-scope.test.ts": 94,
"src/renderer/src/components/settings/integrations-pane-status.test.ts": 29,
"src/renderer/src/components/settings/jira-integration-card.test.tsx": 459,
"src/renderer/src/components/settings/linear-agent-skill-install-cta.test.tsx": 1871,
@@ -8923,14 +8920,12 @@
"src/renderer/src/components/settings/runtime-server-row-presentation.test.ts": 357,
"src/renderer/src/components/settings/runtime-server-row-unverifiable-host.test.tsx": 2162,
"src/renderer/src/components/settings/runtime-share-computer-button.test.tsx": 1304,
"src/renderer/src/components/settings/session-search-computer-rollup.test.ts": 42,
"src/renderer/src/components/settings/settings-deep-link-target-watcher.test.ts": 149,
"src/renderer/src/components/settings/settings-form-option-filter.test.ts": 41,
"src/renderer/src/components/settings/settings-host-scope.test.ts": 76,
"src/renderer/src/components/settings/settings-project-checkout-target.test.ts": 70,
"src/renderer/src/components/settings/settings-project-list.test.ts": 71,
"src/renderer/src/components/settings/settings-project-regrouping.test.ts": 467,
"src/renderer/src/components/settings/settings-search-keywords.test.ts": 123,
"src/renderer/src/components/settings/settings-search.test.ts": 49,
"src/renderer/src/components/settings/settings-setup-guide-progress.test.ts": 408,
"src/renderer/src/components/settings/shortcut-binding-list-mutations.test.ts": 46,
@@ -8995,7 +8990,6 @@
"src/renderer/src/components/sidebar/DeleteWorktreeDialog.unsaved-edits.test.tsx": 1079,
"src/renderer/src/components/sidebar/DeleteWorktreeDialogFooter.test.tsx": 523,
"src/renderer/src/components/sidebar/DeleteWorktreeTargetPreview.test.tsx": 608,
"src/renderer/src/components/sidebar/FilterToggleRow.test.tsx": 214,
"src/renderer/src/components/sidebar/ForgetSshWorkspaceDialog.test.tsx": 1539,
"src/renderer/src/components/sidebar/ImportedWorktreesVisibilityLine.test.tsx": 1451,
"src/renderer/src/components/sidebar/LinearAgentSkillSetupPrompt.reminder-toast.test.tsx": 1545,
@@ -9287,7 +9281,6 @@
"src/renderer/src/components/sidebar/worktree-list/grouping/build-rows.folder-workspace-lanes.test.ts": 197,
"src/renderer/src/components/sidebar/worktree-list/grouping/build-rows.test.ts": 205,
"src/renderer/src/components/sidebar/worktree-list/grouping/cross-project-lineage.test.ts": 185,
"src/renderer/src/components/sidebar/worktree-list/grouping/host-labels.test.ts": 66,
"src/renderer/src/components/sidebar/worktree-list/grouping/imported-rows.test.ts": 1373,
"src/renderer/src/components/sidebar/worktree-list/grouping/recent-project-rank-scan-budget.test.ts": 117,
"src/renderer/src/components/sidebar/worktree-list/listing/held-order.test.ts": 43,
@@ -1,56 +0,0 @@
// @vitest-environment happy-dom
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { TooltipProvider } from '../ui/tooltip'
import { BrowserSshWorkspaceRoutingSetting } from './BrowserSshWorkspaceRoutingSetting'
import type { GlobalSettings } from '../../../../shared/global-settings-types'
vi.mock('../../store', () => ({
useAppStore: (
selector: (state: {
settingsSearchQuery: string
sshTargetLabels: Map<string, string>
}) => unknown
) =>
selector({
settingsSearchQuery: '',
sshTargetLabels: new Map([['target-a', 'openclaw']])
})
}))
type RoutingSettings = Pick<
GlobalSettings,
'browserSshWorkspaceRoutingEnabled' | 'browserSshWorkspaceRoutingDisabledTargetIds'
>
function renderSetting(
settings: RoutingSettings,
updateSettings: (updates: Partial<GlobalSettings>) => void = vi.fn()
): void {
render(
<TooltipProvider>
<BrowserSshWorkspaceRoutingSetting settings={settings} updateSettings={updateSettings} />
</TooltipProvider>
)
}
describe('BrowserSshWorkspaceRoutingSetting', () => {
afterEach(() => {
cleanup()
})
it('hides the per-host list when no host opted out', () => {
renderSetting({})
expect(screen.queryByText(/browsing from this device/i)).toBeNull()
})
it('restores routing for an opted-out host via Use SSH host', () => {
const updateSettings = vi.fn()
renderSetting({ browserSshWorkspaceRoutingDisabledTargetIds: ['target-a'] }, updateSettings)
expect(screen.getByText('openclaw')).toBeTruthy()
fireEvent.click(screen.getByRole('button', { name: 'Use SSH host' }))
expect(updateSettings).toHaveBeenCalledWith({
browserSshWorkspaceRoutingDisabledTargetIds: []
})
})
})
@@ -1,51 +0,0 @@
import { describe, expect, it, vi } from 'vitest'
import type { RemoteServerUpdateEntry } from '@/runtime/remote-server-update-coordinator'
import { getRemoteServerManualUpdateHelp } from './RemoteServerUpdateStatus'
vi.mock('@/i18n/i18n', () => ({
translate: (_key: string, fallback: string) => fallback
}))
const entry: RemoteServerUpdateEntry = {
environmentId: 'server-1',
name: 'Server',
phase: 'manual',
currentVersion: '1.4.0',
targetVersion: null,
progress: null,
runtimeId: 'runtime-1',
liveTabCount: 0,
liveLeafCount: 0,
support: null,
error: null
}
describe('remote server manual update help', () => {
it('does not promise that a manual update enables remote updates when the updater is unavailable', () => {
expect(
getRemoteServerManualUpdateHelp({
...entry,
support: { installMode: 'interactive', automatic: false, reason: 'updater-unavailable' }
})
).toBe('Remote updates are unavailable for this server. Update Orca on the server host.')
})
it('preserves the specific instructions for unsupported installs and development builds', () => {
expect(
getRemoteServerManualUpdateHelp({
...entry,
support: {
installMode: 'unsupported-headless-serve',
automatic: false,
reason: 'manual-service-update-required'
}
})
).toContain('service manager')
expect(
getRemoteServerManualUpdateHelp({
...entry,
support: { installMode: 'interactive', automatic: false, reason: 'unpackaged-build' }
})
).toContain('source checkout')
})
})
@@ -6,10 +6,6 @@ import {
} from './agent-default-env-draft'
describe('agent default environment draft', () => {
it('stringifies environment entries in the settings draft format', () => {
expect(stringifyAgentDefaultEnvDraft({ FOO: 'bar', BAZ: 'qux' })).toBe('FOO=bar BAZ=qux')
})
it('parses back every value it formats', () => {
const env = {
SPACED: 'two words',
@@ -1,48 +0,0 @@
import { describe, expect, it } from 'vitest'
import {
buildHostScopeChoices,
CLIENT_DEFAULT_SCOPE,
isHostScope
} from './host-scoped-setting-scope'
import type { SidebarHostOption } from '../sidebar/sidebar-host-options'
function host(id: SidebarHostOption['id'], label: string): SidebarHostOption {
const kind = id === 'local' ? 'local' : id.startsWith('runtime:') ? 'runtime' : 'ssh'
return {
id,
label,
detail: '',
kind,
health: 'available',
presence: kind === 'local' ? 'local' : 'configured'
}
}
describe('buildHostScopeChoices', () => {
it('lists the client default first, then non-local hosts', () => {
const choices = buildHostScopeChoices(
[host('local', 'Local Mac'), host('ssh:box', 'Box'), host('runtime:env', 'Server')],
'Client default'
)
expect(choices).toEqual([
{ scope: CLIENT_DEFAULT_SCOPE, label: 'Client default' },
{ scope: 'ssh:box', label: 'Box' },
{ scope: 'runtime:env', label: 'Server' }
])
})
it('excludes the local host', () => {
const choices = buildHostScopeChoices([host('local', 'Local Mac')], 'Client default')
expect(choices).toEqual([{ scope: CLIENT_DEFAULT_SCOPE, label: 'Client default' }])
})
})
describe('isHostScope', () => {
it('is false for the client default sentinel', () => {
expect(isHostScope(CLIENT_DEFAULT_SCOPE)).toBe(false)
})
it('is true for a real host id', () => {
expect(isHostScope('ssh:box')).toBe(true)
})
})
@@ -13,13 +13,6 @@ describe('parsePluginInstallSource', () => {
})
})
it('separates the git URL and ref at the last hash', () => {
expect(parsePluginInstallSource('git', 'https://example.test/plugin.git#v1.2.3')).toEqual({
ok: true,
source: { kind: 'git', url: 'https://example.test/plugin.git', ref: 'v1.2.3' }
})
})
it('accepts HTTPS and SSH git URLs', () => {
expect(parsePluginInstallSource('git', 'ssh://git@example.test/acme/plugin.git#main')).toEqual({
ok: true,
@@ -41,11 +34,4 @@ describe('parsePluginInstallSource', () => {
reason: 'invalid-git-url'
})
})
it('keeps local paths opaque', () => {
expect(parsePluginInstallSource('local-path', ' C:\\plugins\\demo ')).toEqual({
ok: true,
source: { kind: 'local-path', path: 'C:\\plugins\\demo' }
})
})
})
@@ -1,25 +1,7 @@
import { describe, expect, it } from 'vitest'
import {
areHookSettingsDraftsEqual,
getHookSettingsDraft,
renderYamlScriptPreview
} from './repository-hook-settings-draft'
import { areHookSettingsDraftsEqual, getHookSettingsDraft } from './repository-hook-settings-draft'
describe('repository hook settings draft', () => {
it('normalizes persisted settings without dropping either script', () => {
const draft = getHookSettingsDraft({
mode: 'override',
scripts: { setup: 'pnpm install', archive: '' }
})
expect(draft).toMatchObject({
mode: 'override',
setupRunPolicy: 'run-by-default',
setupAgentStartupPolicy: 'start-immediately',
scripts: { setup: 'pnpm install', archive: '' }
})
})
it('includes every persisted field in dirty-draft equality', () => {
const baseline = getHookSettingsDraft(undefined)
expect(areHookSettingsDraftsEqual(baseline, { ...baseline })).toBe(true)
@@ -36,15 +18,4 @@ describe('repository hook settings draft', () => {
})
).toBe(false)
})
it('renders the exact shared YAML projection', () => {
expect(
renderYamlScriptPreview({
scripts: { setup: 'pnpm install\npnpm build', archive: 'pnpm clean' },
issueCommand: 'Complete {{artifact_url}}'
})
).toBe(
'scripts:\n setup: |\n pnpm install\n pnpm build\n archive: |\n pnpm clean\nissueCommand: |\n Complete {{artifact_url}}'
)
})
})
@@ -5,7 +5,6 @@ import { afterEach, expect, it, vi } from 'vitest'
import type { PublicKnownRuntimeEnvironment } from '../../../../shared/runtime-environments'
import { useAppStore } from '@/store'
import { RuntimeDefaultHostRow } from './runtime-default-host-row'
import { LOCAL_RUNTIME_VALUE } from './runtime-environment-selection'
const initialState = useAppStore.getInitialState()
afterEach(() => {
@@ -36,12 +35,6 @@ function renderRow(activeValue: string): void {
)
}
it('says new projects stay here when nothing else can be chosen', () => {
renderRow(LOCAL_RUNTIME_VALUE)
expect(screen.queryByText(/until you add a server/)).not.toBeNull()
expect(screen.queryByRole('combobox')).toBeNull()
})
// The default can be a host the server list leaves out; it must stay visible and changeable.
it('shows the selector for a default that is not this computer', () => {
useAppStore.setState({ runtimeEnvironments: [wslHost] })
@@ -1,43 +0,0 @@
import { expect, it } from 'vitest'
import {
isTurnOnableSessionSearchState,
orderSessionSearchServers,
type SessionSearchComputerEntry
} from './session-search-computer-rollup'
const fleet: SessionSearchComputerEntry[] = [
{ id: 'local', name: 'Local Mac', state: 'on' },
{ id: 'a', name: 'build-01', state: 'on' },
{ id: 'b', name: 'gpu-a', state: 'off' },
{ id: 'c', name: 'linux 1', state: 'offline' },
{ id: 'd', name: 'nas', state: 'offline' },
{ id: 'e', name: 'm4 air', state: 'needs-update' },
{ id: 'f', name: 'probing', state: 'checking' }
]
it('will not offer to turn on a computer it cannot reach or that is too old', () => {
expect(isTurnOnableSessionSearchState('off')).toBe(true)
for (const state of ['on', 'offline', 'needs-update', 'checking'] as const) {
expect(isTurnOnableSessionSearchState(state)).toBe(false)
}
expect(fleet.filter((entry) => isTurnOnableSessionSearchState(entry.state))).toHaveLength(1)
})
it('orders reachable and working first, then by name inside each group', () => {
const ordered = orderSessionSearchServers([
{ id: 'f', name: 'probing', state: 'checking' },
{ id: 'c', name: 'linux 1', state: 'offline' },
{ id: 'e', name: 'm4 air', state: 'needs-update' },
{ id: 'b', name: 'gpu-a', state: 'off' },
{ id: 'a', name: 'build-01', state: 'on' },
{ id: 'z', name: 'aa-on', state: 'on' }
])
expect(ordered.map((entry) => entry.name)).toEqual([
'aa-on',
'build-01',
'gpu-a',
'probing',
'm4 air',
'linux 1'
])
})
@@ -1,53 +0,0 @@
import { beforeEach, describe, expect, it } from 'vitest'
import { i18n } from '@/i18n/i18n'
import { searchKeywords, translateSearchKeyword } from './settings-search-keywords'
describe('settings-search-keywords', () => {
beforeEach(async () => {
await i18n.changeLanguage('en')
})
it('returns only localized text in English UI', async () => {
await i18n.changeLanguage('en')
expect(translateSearchKeyword('settings.appearance.language.title', 'Language')).toEqual([
'Language'
])
})
it('keeps English fallback and aliases in localized UI', async () => {
await i18n.changeLanguage('ko')
expect(
translateSearchKeyword('settings.appearance.language.title', 'Language', {
aliases: ['locale']
})
).toEqual(['언어', 'Language', 'locale'])
})
it('supports english-only keyword specs for brands', async () => {
await i18n.changeLanguage('ko')
expect(searchKeywords([{ key: 'unused', fallback: 'github', englishOnly: true }])).toEqual([
'github'
])
})
it('deduplicates repeated keyword variants', () => {
expect(searchKeywords(['terminal', 'terminal', { key: 'k', fallback: 'terminal' }])).toEqual([
'terminal'
])
})
it('indexes localized agent search synonyms in Korean UI', async () => {
await i18n.changeLanguage('ko')
expect(
searchKeywords([
{ key: 'auto.components.settings.agents.search.66b6b82eb4', fallback: 'awake' }
])
).toEqual(['깨어 있음', 'awake'])
expect(
searchKeywords([
{ key: 'auto.components.settings.agents.search.2afd3b5858', fallback: 'enable' }
])
).toEqual(['활성화', 'enable'])
})
})
@@ -1,58 +0,0 @@
// @vitest-environment happy-dom
/** Tailwind v4 padding-inline from px-* outranks physical pl-* and can erase sub-option indentation. */
import { act } from 'react'
import { createRoot, type Root } from 'react-dom/client'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { FilterToggleRow } from './FilterToggleRow'
let container: HTMLDivElement
let root: Root
function renderRow(indented: boolean): HTMLElement {
act(() => {
root.render(
<FilterToggleRow
icon={null}
label="Row"
checked={false}
onChange={vi.fn()}
indented={indented}
/>
)
})
const row = container.querySelector('[role="switch"]')
if (!(row instanceof HTMLElement)) {
throw new Error('FilterToggleRow did not render a switch')
}
return row
}
function paddingClasses(row: HTMLElement): string[] {
return row.className.split(/\s+/).filter((cls) => /^p[xlr]?-/.test(cls))
}
beforeEach(() => {
container = document.createElement('div')
document.body.appendChild(container)
root = createRoot(container)
})
afterEach(() => {
act(() => root.unmount())
container.remove()
})
describe('FilterToggleRow', () => {
it('indents a sub-option past the row above it', () => {
const indented = paddingClasses(renderRow(true))
const flat = paddingClasses(renderRow(false))
expect(indented).toContain('pl-7')
expect(flat).toContain('pl-2')
})
it('never pairs the indent with a padding-inline utility that would outrank it', () => {
expect(paddingClasses(renderRow(true)).filter((cls) => cls.startsWith('px-'))).toEqual([])
})
})
@@ -16,17 +16,6 @@ describe('routeAddRepoBrowse', () => {
expect(pickFolders).not.toHaveBeenCalled()
})
it('preserves native folder browsing for desktop local hosts', () => {
const pickFolders = vi.fn()
routeAddRepoBrowse(parseExecutionHostId('local'), {
browseLocal: pickFolders,
browseRuntime: vi.fn()
})
expect(pickFolders).toHaveBeenCalledOnce()
})
it('opens nothing for an SSH host, which holds projects only through its server', () => {
const actions = { browseLocal: vi.fn(), browseRuntime: vi.fn() }
@@ -35,14 +24,4 @@ describe('routeAddRepoBrowse', () => {
expect(actions.browseLocal).not.toHaveBeenCalled()
expect(actions.browseRuntime).not.toHaveBeenCalled()
})
it('opens the Windows folder picker for a WSL host instead of the in-app browser', () => {
const actions = { browseLocal: vi.fn(), browseRuntime: vi.fn(), browseWslHost: vi.fn() }
routeAddRepoBrowse(parseExecutionHostId('runtime:wsl%3AUbuntu'), actions)
expect(actions.browseWslHost).toHaveBeenCalledOnce()
expect(actions.browseRuntime).not.toHaveBeenCalled()
expect(actions.browseLocal).not.toHaveBeenCalled()
})
})
@@ -1,44 +0,0 @@
import { describe, expect, it } from 'vitest'
import type { ExecutionHostId } from '../../../../../../shared/execution-host'
import type { Repo } from '../../../../../../shared/repo-types'
import type { Worktree } from '../../../../../../shared/worktree/types'
import {
getHostWorktreeCounts,
getHostWorktreeIds
} from '../../../../../../shared/sidebar-list/host-labels'
const LOCAL = 'local' as ExecutionHostId
function makeRepos(hostByRepo: Record<string, ExecutionHostId | undefined>): Map<string, Repo> {
return new Map(
Object.entries(hostByRepo).map(([id, executionHostId]) => [
id,
{ id, path: `/${id}`, ...(executionHostId ? { executionHostId } : {}) } as Repo
])
)
}
function makeWorktrees(rows: { id: string; repoId: string }[]): Worktree[] {
return rows.map((row) => row as Worktree)
}
describe('host worktree counts and ids', () => {
it('counts a repeated host identity once', () => {
const repoMap = makeRepos({ 'repo-local': undefined })
const repoOf = (worktree: Worktree) => repoMap.get(worktree.repoId)
const worktrees = makeWorktrees([
{ id: 'a', repoId: 'repo-local' },
{ id: 'a', repoId: 'repo-local' },
{ id: 'b', repoId: 'repo-local' }
])
expect(getHostWorktreeCounts(worktrees, repoOf, LOCAL)?.get(LOCAL)).toBe(2)
expect(getHostWorktreeIds(worktrees, repoOf, LOCAL)?.get(LOCAL)).toEqual(['a', 'b'])
})
it('returns undefined for an empty lane', () => {
const repoOf = () => undefined
expect(getHostWorktreeCounts([], repoOf, LOCAL)).toBeUndefined()
expect(getHostWorktreeIds([], repoOf, LOCAL)).toBeUndefined()
})
})
@@ -4,14 +4,6 @@ import { describe, expect, it } from 'vitest'
import { isSidebarPointerDragBlocked } from './worktree-sidebar-pointer-drag-dom'
describe('worktree sidebar pointer drag DOM guards', () => {
it('allows plain row targets to start pointer drags', () => {
const row = document.createElement('div')
const card = document.createElement('div')
row.appendChild(card)
expect(isSidebarPointerDragBlocked(card, row)).toBe(false)
})
it('blocks portaled hover card targets outside the row', () => {
const row = document.createElement('div')
const hoverCardContent = document.createElement('div')
@@ -23,14 +15,6 @@ describe('worktree sidebar pointer drag DOM guards', () => {
row.remove()
})
it('blocks interactive targets inside the row', () => {
const row = document.createElement('div')
const button = document.createElement('button')
row.appendChild(button)
expect(isSidebarPointerDragBlocked(button, row)).toBe(true)
})
it('blocks icon targets inside interactive row controls', () => {
const row = document.createElement('div')
const button = document.createElement('button')
@@ -36,20 +36,4 @@ describe('revealElementInScrollContainer', () => {
expect(scrollTo).toHaveBeenCalledWith({ top: 387, behavior: 'smooth' })
expect(onScrollIssued).toHaveBeenCalledWith(387)
})
it('does not report a scroll when the element is already in view', () => {
const { container, scrollTo } = makeContainer(0, 673)
const onScrollIssued = vi.fn()
const revealed = revealElementInScrollContainer(
container,
makeElement(200, 260),
'smooth',
onScrollIssued
)
expect(revealed).toBe(true)
expect(scrollTo).not.toHaveBeenCalled()
expect(onScrollIssued).not.toHaveBeenCalled()
})
})