mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
test: remove 20 low-value cases and a presentation suite (#34333)
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -8352,7 +8352,6 @@
|
||||
"src/renderer/src/components/right-sidebar/AiVaultSearchEvidence.test.tsx": 2230,
|
||||
"src/renderer/src/components/right-sidebar/AiVaultSessionActionMenuItems.test.tsx": 663,
|
||||
"src/renderer/src/components/right-sidebar/AiVaultSessionHistoryDialog.test.tsx": 1929,
|
||||
"src/renderer/src/components/right-sidebar/AiVaultSessionListBar.test.tsx": 516,
|
||||
"src/renderer/src/components/right-sidebar/AiVaultSessionRow.structured-title.test.tsx": 2357,
|
||||
"src/renderer/src/components/right-sidebar/AiVaultSessionRow.test.tsx": 1504,
|
||||
"src/renderer/src/components/right-sidebar/AiVaultSessionSubagents.test.tsx": 1926,
|
||||
|
||||
@@ -94,16 +94,4 @@ describe('CSV delimiter selection', () => {
|
||||
expect(screen.getByRole('columnheader', { name: 'value' })).toBeTruthy()
|
||||
expect(screen.getByRole('cell', { name: '2' })).toBeTruthy()
|
||||
})
|
||||
|
||||
it('resets to Auto when the editor mounts a different file identity', async () => {
|
||||
const { rerender } = render(
|
||||
<CsvViewer key="first" content={'name;value\na;1'} filePath="first.csv" />
|
||||
)
|
||||
await chooseDelimiter('Comma (,)')
|
||||
|
||||
rerender(<CsvViewer key="second" content={'name\tvalue\nb\t2'} filePath="second.tsv" />)
|
||||
|
||||
expect(screen.getByRole('combobox', { name: 'Delimiter' }).textContent).toBe('Auto (Tab)')
|
||||
expect(screen.getByRole('columnheader', { name: 'value' })).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -31,16 +31,6 @@ const FINISHED: AiVaultScanProgress = {
|
||||
settledAt: 90_000
|
||||
}
|
||||
|
||||
it('says the finished total in the strip and opens to one row per agent', async () => {
|
||||
render(<AiVaultScanProgressStrip progress={FINISHED} />)
|
||||
expect(screen.getByText('102,452 files').parentElement?.textContent).toBe('Scanned 102,452 files')
|
||||
expect(screen.queryByText('Codex')).toBeNull()
|
||||
|
||||
await userEvent.setup().click(screen.getByRole('button'))
|
||||
expect(screen.getByText('77,483 files')).toBeTruthy()
|
||||
expect(screen.getByText('1 database')).toBeTruthy()
|
||||
})
|
||||
|
||||
it('keeps a narrower cached panel off the broader key while a late matching panel loads it', async () => {
|
||||
const lowerDepth = { scopePaths: ['/project'], includeAntigravityIdeSessions: true, limit: 100 }
|
||||
const broader = aiVaultLocalScanKey({ ...lowerDepth, limit: 1000 })
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { cleanup, render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { afterEach, expect, it, vi } from 'vitest'
|
||||
import { aiVaultBrowseSortMenu, aiVaultSearchSortMenu } from './ai-vault-sort-options'
|
||||
import {
|
||||
aiVaultResultCountLabel,
|
||||
AiVaultSessionListBar,
|
||||
aiVaultSessionCountLabel
|
||||
} from './AiVaultSessionListBar'
|
||||
|
||||
afterEach(cleanup)
|
||||
|
||||
it('reports how many hits are shown and which order produced them', () => {
|
||||
const { rerender } = render(
|
||||
<AiVaultSessionListBar
|
||||
label={aiVaultResultCountLabel(1)}
|
||||
value="relevance"
|
||||
menu={aiVaultSearchSortMenu()}
|
||||
onChange={vi.fn()}
|
||||
/>
|
||||
)
|
||||
expect(screen.getByText('1 result')).toBeTruthy()
|
||||
expect(screen.getByRole('button', { name: 'Sort results: Most relevant' })).toBeTruthy()
|
||||
|
||||
rerender(
|
||||
<AiVaultSessionListBar
|
||||
label={aiVaultResultCountLabel(20)}
|
||||
value="newest"
|
||||
menu={aiVaultSearchSortMenu()}
|
||||
onChange={vi.fn()}
|
||||
/>
|
||||
)
|
||||
expect(screen.getByText('20 results')).toBeTruthy()
|
||||
expect(screen.getByRole('button', { name: 'Sort results: Newest' })).toBeTruthy()
|
||||
})
|
||||
|
||||
it('reports how much of the browsed history is shown and its order', () => {
|
||||
render(
|
||||
<AiVaultSessionListBar
|
||||
label={aiVaultSessionCountLabel(4, 12)}
|
||||
value="created"
|
||||
menu={aiVaultBrowseSortMenu()}
|
||||
onChange={vi.fn()}
|
||||
/>
|
||||
)
|
||||
expect(screen.getByText('4 of 12 sessions')).toBeTruthy()
|
||||
expect(screen.getByRole('button', { name: 'Sort sessions: Created' })).toBeTruthy()
|
||||
})
|
||||
|
||||
it('counts plainly when filters hide nothing', () => {
|
||||
render(
|
||||
<AiVaultSessionListBar
|
||||
label={aiVaultSessionCountLabel(12, 12)}
|
||||
value="updated"
|
||||
menu={aiVaultBrowseSortMenu()}
|
||||
onChange={vi.fn()}
|
||||
/>
|
||||
)
|
||||
expect(screen.getByText('12 sessions')).toBeTruthy()
|
||||
})
|
||||
|
||||
it('hands the picked search order back to the caller', async () => {
|
||||
const onChange = vi.fn()
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 })
|
||||
render(
|
||||
<AiVaultSessionListBar
|
||||
label={aiVaultResultCountLabel(20)}
|
||||
value="relevance"
|
||||
menu={aiVaultSearchSortMenu()}
|
||||
onChange={onChange}
|
||||
/>
|
||||
)
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Sort results: Most relevant' }))
|
||||
await user.click(await screen.findByRole('menuitemradio', { name: 'Newest' }))
|
||||
|
||||
expect(onChange).toHaveBeenCalledExactlyOnceWith('newest')
|
||||
})
|
||||
|
||||
it('hands the picked browse order back to the caller', async () => {
|
||||
const onChange = vi.fn()
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 })
|
||||
render(
|
||||
<AiVaultSessionListBar
|
||||
label={aiVaultSessionCountLabel(4, 12)}
|
||||
value="updated"
|
||||
menu={aiVaultBrowseSortMenu()}
|
||||
onChange={onChange}
|
||||
/>
|
||||
)
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Sort sessions: Last updated' }))
|
||||
await user.click(await screen.findByRole('menuitemradio', { name: 'Created' }))
|
||||
|
||||
expect(onChange).toHaveBeenCalledExactlyOnceWith('created')
|
||||
})
|
||||
@@ -28,22 +28,6 @@ afterEach(() => {
|
||||
})
|
||||
|
||||
describe('FirstPromptCard', () => {
|
||||
it('labels stored firstUserPrompt text as the first prompt', () => {
|
||||
const remoteSession = {
|
||||
...session,
|
||||
executionHostId: 'ssh:dev-box',
|
||||
firstUserPrompt: 'The authoritative opening ask'
|
||||
} as AiVaultSession
|
||||
stubApi(vi.fn().mockResolvedValue({ prompt: null }))
|
||||
|
||||
render(
|
||||
<FirstPromptCard session={remoteSession} preview={sessionPromptPreview(remoteSession)} />
|
||||
)
|
||||
|
||||
expect(screen.getByText('First prompt')).toBeTruthy()
|
||||
expect(screen.getByText('The authoritative opening ask')).toBeTruthy()
|
||||
})
|
||||
|
||||
it('labels a remote preview fallback as a recent prompt when no full read is available', () => {
|
||||
const getFirstUserPrompt = vi.fn().mockResolvedValue({ prompt: null })
|
||||
const remoteSession = {
|
||||
|
||||
@@ -185,20 +185,6 @@ describe('SidebarHeader', () => {
|
||||
expect(mocks.openWorkspaceCreationComposerWithTourHandoff).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('opens the composer the same way once projects exist', async () => {
|
||||
mockState.repos = [{ id: 'repo-a' }]
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
|
||||
await act(async () => {
|
||||
createButton().click()
|
||||
})
|
||||
|
||||
expect(createButton().disabled).toBe(false)
|
||||
expect(mocks.openWorkspaceCreationComposerWithTourHandoff).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('reaches Add project and New workspace in one click each, with no menu', async () => {
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
@@ -215,162 +201,4 @@ describe('SidebarHeader', () => {
|
||||
expect(mockState.openModal).toHaveBeenCalledWith('add-repo')
|
||||
expect(mocks.openWorkspaceCreationComposerWithTourHandoff).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('keeps the create button rightmost so the frequent action stays where it was', () => {
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
|
||||
const labels = [...container.querySelectorAll<HTMLElement>('[aria-label]')]
|
||||
.map((node) => node.getAttribute('aria-label'))
|
||||
.filter((label): label is string => label === 'Add project' || label === 'New workspace')
|
||||
expect(labels).toEqual(['Add project', 'New workspace'])
|
||||
})
|
||||
|
||||
it('advertises the workspace shortcut on the create tooltip, and omits it when unassigned', () => {
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
expect(container.textContent).toContain('⌘N')
|
||||
|
||||
mocks.shortcutLabel.current = null
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
expect(container.textContent).not.toContain('⌘N')
|
||||
})
|
||||
|
||||
it('opens agent activity from the bell button', () => {
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
|
||||
const activityButton = container.querySelector<HTMLButtonElement>(
|
||||
'[aria-label="View activity"]'
|
||||
)
|
||||
expect(activityButton).toBeTruthy()
|
||||
|
||||
act(() => {
|
||||
activityButton?.click()
|
||||
})
|
||||
|
||||
expect(mockState.setSidebarBody).toHaveBeenCalledWith('agents')
|
||||
})
|
||||
|
||||
it('shows the Agents introduction only for migrated users and never offers a hide action', () => {
|
||||
mockState.settings = { agentsSidebarMigratedFromExperimental: true }
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
|
||||
expect(container.querySelector('[data-intro-open]')).toBeTruthy()
|
||||
expect(container.textContent).toContain('Agents are easier to find')
|
||||
expect(container.textContent).not.toContain('Hide Agents')
|
||||
|
||||
mockState.settings = {}
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
expect(container.querySelector('[data-intro-open]')).toBeNull()
|
||||
})
|
||||
|
||||
it('turns off agent activity from the active bell button', () => {
|
||||
mockState.sidebarBody = 'agents'
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
|
||||
const activityButton = container.querySelector<HTMLButtonElement>(
|
||||
'[aria-label="Turn off activity view"]'
|
||||
)
|
||||
expect(activityButton?.getAttribute('aria-pressed')).toBe('true')
|
||||
|
||||
act(() => {
|
||||
activityButton?.click()
|
||||
})
|
||||
|
||||
expect(mockState.setSidebarBody).toHaveBeenCalledWith('workspaces')
|
||||
})
|
||||
|
||||
it('uses the legacy title based on workspace grouping', () => {
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
|
||||
expect(container.querySelector('[data-sidebar-section-title="projects"]')?.textContent).toBe(
|
||||
'Projects'
|
||||
)
|
||||
|
||||
mockState.groupBy = 'workspace-status'
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
expect(container.querySelector('[data-sidebar-section-title="workspaces"]')?.textContent).toBe(
|
||||
'Workspaces'
|
||||
)
|
||||
})
|
||||
|
||||
it('swaps only the options slot in the agents view so no header button shifts', () => {
|
||||
mockState.sidebarBody = 'agents'
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
|
||||
expect(container.querySelector('[aria-label="Turn off activity view"]')).toBeTruthy()
|
||||
expect(container.querySelector('[aria-label="New workspace"]')).toBeTruthy()
|
||||
expect(container.querySelector('[aria-label="Workspace options"]')).toBeNull()
|
||||
expect(container.querySelector('[aria-label="Add project"]')).toBeTruthy()
|
||||
})
|
||||
|
||||
it('keeps the activity bell and actions on one row at the default sidebar width', () => {
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
|
||||
const headerRow = container.querySelector('.mt-2')
|
||||
const headerClasses = new Set(headerRow?.className.split(/\s+/) ?? [])
|
||||
expect(headerClasses.has('flex-wrap')).toBe(false)
|
||||
expect(headerClasses.has('h-8')).toBe(true)
|
||||
expect(container.querySelector('[aria-label="View activity"]')).toBeTruthy()
|
||||
expect(container.querySelector('[aria-label="Add project"]')).toBeTruthy()
|
||||
expect(container.querySelector('[aria-label="New workspace"]')).toBeTruthy()
|
||||
})
|
||||
|
||||
it('keeps the same actions on one row at compact width', async () => {
|
||||
mockState.sidebarWidth = 220
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
|
||||
expect(container.querySelector('[aria-label="Add project"]')).toBeTruthy()
|
||||
expect(container.querySelector('[aria-label="View activity"]')).toBeTruthy()
|
||||
expect(container.querySelector('[aria-label="New workspace"]')).toBeTruthy()
|
||||
expect(container.querySelector('[aria-label="Workspace options"]')).toBeTruthy()
|
||||
expect(container.querySelector('[aria-label="More workspace actions"]')).toBeNull()
|
||||
|
||||
await act(async () => {
|
||||
createButton().click()
|
||||
})
|
||||
expect(mocks.openWorkspaceCreationComposerWithTourHandoff).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('does not reset a persisted agents body before settings hydrate', () => {
|
||||
mockState.settings = undefined
|
||||
mockState.sidebarBody = 'agents'
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
|
||||
expect(mockState.setSidebarBody).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('does not expose the deprecated full Agents view in agents mode', () => {
|
||||
mockState.settings = { agentsSidebarIntroShown: true }
|
||||
mockState.sidebarBody = 'agents'
|
||||
act(() => {
|
||||
root.render(<SidebarHeader onWorkspaceBoardMenuOpenChange={vi.fn()} />)
|
||||
})
|
||||
|
||||
expect(container.querySelector('[aria-label="Open full Agents view"]')).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user