mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
Remove low-value test examples and two suites
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -5625,7 +5625,6 @@
|
||||
"src/renderer/src/components/sidebar/worktree-list/listing/worktree-sort-label-ordering.test.ts": 114,
|
||||
"src/renderer/src/components/sidebar/wsl-host-offer-move.test.ts": 227,
|
||||
|
||||
"src/renderer/src/components/skills/installation/SkillInstallManagementDialog.test.tsx": 3300,
|
||||
"src/renderer/src/components/skills/sharing/SkillSharedLinkRow.test.tsx": 817,
|
||||
"src/renderer/src/components/skills/SkillsPage.test.tsx": 3822,
|
||||
"src/renderer/src/components/skills/catalog/skill-agent-filter.test.ts": 274,
|
||||
@@ -6719,7 +6718,6 @@
|
||||
"src/renderer/src/store/github/refresh/github-pr-manual-refresh-broadcast.test.ts": 693,
|
||||
"src/renderer/src/store/github/refresh/github-pr-refresh-states-leak.test.ts": 1327,
|
||||
"src/renderer/src/store/github/pull-requests/github-pr-request-lifetime.test.ts": 1458,
|
||||
"src/renderer/src/store/github/projects/github-project-view-tables.test.ts": 656,
|
||||
"src/renderer/src/store/github/repositories/github-repo-lookup-index.test.ts": 51,
|
||||
"src/renderer/src/store/github/review-threads/github-review-thread-rollback.test.ts": 663,
|
||||
"src/renderer/src/store/github/task-records/github-task-record-retries.test.ts": 758,
|
||||
|
||||
@@ -204,15 +204,4 @@ describe('the page language catalog', () => {
|
||||
expect(i18n.getMobileUiLocale()).toBe('ko')
|
||||
expect(i18n.translate('greeting', 'Hello')).toBe('안녕하세요')
|
||||
})
|
||||
|
||||
it('imports the chunk an older shell left on disk, with no wait and no request', async () => {
|
||||
chunksOnDisk.set('es', { greeting: 'Hola' })
|
||||
const client = fakeClient('reconnecting')
|
||||
openPage(client, fakeStore({}))
|
||||
|
||||
await i18n.activateMobileUiLocale('es')
|
||||
|
||||
expect(i18n.translate('greeting', 'Hello')).toBe('Hola')
|
||||
expect(client.sent).toHaveLength(0)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -76,18 +76,6 @@ describe('useMobileNativeChatSendError', () => {
|
||||
expect(api().message).toBeNull()
|
||||
})
|
||||
|
||||
it('a refusal behind a question goes once it is answered', async () => {
|
||||
await render()
|
||||
await showing({ working: false, prompt: true })
|
||||
await act(async () =>
|
||||
api().show("Answer the agent's question or approval, then run /clear.", {
|
||||
refusedWhile: 'prompt'
|
||||
})
|
||||
)
|
||||
await showing({ working: false, prompt: false })
|
||||
expect(api().message).toBeNull()
|
||||
})
|
||||
|
||||
it('a failure naming nothing the phone shows, or background tasks it cannot see, stays', async () => {
|
||||
await render()
|
||||
await act(async () => api().show('Message not sent'))
|
||||
@@ -115,16 +103,6 @@ describe('useMobileNativeChatSendError', () => {
|
||||
expect(api().message).toBeNull()
|
||||
})
|
||||
|
||||
it('falls back to the toast when the banner is not mounted', async () => {
|
||||
await act(async () => {
|
||||
renderer = create(createElement(Harness, { scopeKey: 'terminal-1', bannerMounted: false }))
|
||||
})
|
||||
await act(async () => api().show('Delivery unconfirmed'))
|
||||
|
||||
expect(showToast).toHaveBeenCalledWith('Delivery unconfirmed', 1600)
|
||||
expect(api().message).toBeNull()
|
||||
})
|
||||
|
||||
it('toasts a deferred failure that resolves after the user switched tabs', async () => {
|
||||
await render('terminal-1')
|
||||
const showFromTabA = api().show
|
||||
|
||||
@@ -342,33 +342,6 @@ it('phone captures accepted echoed inputs, preserves false, and freezes empty vs
|
||||
await harness.unmount()
|
||||
})
|
||||
|
||||
it('accepts a typed literal at an attached fence while options refresh with no menu', async () => {
|
||||
const pending = deferred<AgentSessionOptionsResult>()
|
||||
let reads = 0
|
||||
const client = optionsClient(() =>
|
||||
++reads === 1 ? Promise.resolve({ models: [], current: {} }) : pending.promise
|
||||
)
|
||||
const { calls, mutate } = recordingMutate(async () =>
|
||||
accepted({ key: 'model', value: 'literal', options: { model: 'literal' } }, true)
|
||||
)
|
||||
const view = await mountOptions({ ...BASE, client: client.client, mutate })
|
||||
await view.rerender({ fence: 2 })
|
||||
let result = true
|
||||
await act(async () => {
|
||||
result = await view.current().setStructuredOption('model', 'literal')
|
||||
})
|
||||
expect(result).toBe(true)
|
||||
expect(calls).toHaveLength(1)
|
||||
await act(async () => pending.resolve({ models: [], current: {} }))
|
||||
await settle()
|
||||
await act(async () => {
|
||||
result = await view.current().setStructuredOption('model', 'literal')
|
||||
})
|
||||
expect(result).toBe(true)
|
||||
expect(calls).toHaveLength(2)
|
||||
await view.unmount()
|
||||
})
|
||||
|
||||
it('refreshes saved planning intent from the same host status stamp without remounting', async () => {
|
||||
let interactionMode: 'default' | 'plan' = 'default'
|
||||
const client = optionsClient(async () => ({
|
||||
|
||||
@@ -243,15 +243,6 @@ describe('useFolderCreateFlow', () => {
|
||||
setupDecision: 'skip'
|
||||
})
|
||||
})
|
||||
it("refreshes the folder when a form's create may have landed", async () => {
|
||||
const refetch = vi.fn()
|
||||
const { flow } = mountFlow(refetch)
|
||||
const b = repoIn()
|
||||
const form = await openComposer(flow, b)
|
||||
|
||||
form.folderLaunch?.submit.begin({ ...b.repo, path: '/w/b' })?.settle('uncertain')
|
||||
expect(refetch).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
async function setupRefusedRetry(flow: { current: Flow | null }) {
|
||||
const a = repoIn()
|
||||
const lost = new FakeSession('connected')
|
||||
|
||||
@@ -31,37 +31,6 @@ function statuses(tap: ReturnType<typeof recorder>) {
|
||||
}
|
||||
|
||||
describe('Codex terminal failure categories', () => {
|
||||
it.each([
|
||||
['rateLimitExceeded', 'usageLimitReached'],
|
||||
['flexUnavailable', 'providerUnavailable'],
|
||||
['modelNotFound', 'modelUnavailable'],
|
||||
['policyCapacityUnavailable', 'providerUnavailable'],
|
||||
['misalignmentPolicyViolation', 'providerSafetyStopped'],
|
||||
['serverOverloaded', 'providerUnavailable'],
|
||||
['cyberPolicy', 'providerSafetyStopped']
|
||||
])('categorizes %s without exposing its diagnostic', (code, kind) => {
|
||||
for (const info of [code, { [code]: { httpStatusCode: 401 } }]) {
|
||||
const tap = recorder()
|
||||
const translator = translatorFor(tap)
|
||||
translator.handle(notification('error', error(info)))
|
||||
expect(statuses(tap)).toMatchObject([{ failure: { kind } }])
|
||||
expect(statuses(tap)[0]?.text).not.toContain(DIAGNOSTIC)
|
||||
expect(statuses(tap)[0]?.providerFrame?.payload.head).toContain(DIAGNOSTIC)
|
||||
translator.dispose()
|
||||
}
|
||||
})
|
||||
|
||||
it('uses the existing usage-limit category for HTTP 429 retry exhaustion', () => {
|
||||
const tap = recorder()
|
||||
const translator = translatorFor(tap)
|
||||
translator.handle(
|
||||
notification('error', error({ responseTooManyFailedAttempts: { httpStatusCode: 429 } }))
|
||||
)
|
||||
expect(statuses(tap)).toMatchObject([
|
||||
{ tone: 'warning', failure: { kind: 'usageLimitReached' } }
|
||||
])
|
||||
})
|
||||
|
||||
it('ends a recorded-shape failed completion carrying an unknown future code', () => {
|
||||
const frames: {
|
||||
case: string
|
||||
|
||||
@@ -293,19 +293,6 @@ describe('agent mail between paired Orca servers', () => {
|
||||
expect(b.db.getInbox(10).filter((message) => message.subject === 'Once')).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('refuses payload fields before sending anything', async () => {
|
||||
const sent = await mutation(a, 'orchestration.send', {
|
||||
from: 'term_a',
|
||||
on: 'devB',
|
||||
to: 'term_b',
|
||||
subject: 'Report',
|
||||
payload: '{"taskId":"task_1"}'
|
||||
})
|
||||
|
||||
expect(sent).toMatchObject({ ok: false, error: { code: 'invalid_argument' } })
|
||||
expect(b.db.getInbox(10)).toEqual([])
|
||||
})
|
||||
|
||||
it('refuses mail to a worker another Orca coordinates', async () => {
|
||||
vi.spyOn(b.db, 'findActiveRemoteAttachmentForPane').mockImplementation((paneKey) =>
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: a test double carrying only the fields the code under test reads.
|
||||
@@ -323,19 +310,6 @@ describe('agent mail between paired Orca servers', () => {
|
||||
expect(b.db.getInbox(10)).toEqual([])
|
||||
})
|
||||
|
||||
it('refuses a conversation ID that is not a peer conversation', async () => {
|
||||
const delivered = await transport.call('devB', 'orchestration.peerMailDeliver', {
|
||||
conversationId: 'ctx_aaaaaaaaaaaa',
|
||||
messageId: 'msg_aaaaaaaaaaaa',
|
||||
to: 'term_b',
|
||||
senderLabel: "term_a on Jinwoo's Mac",
|
||||
subject: 'Into a dispatch'
|
||||
})
|
||||
|
||||
expect(delivered).toMatchObject({ ok: false, error: { code: 'invalid_argument' } })
|
||||
expect(b.db.getInbox(10)).toEqual([])
|
||||
})
|
||||
|
||||
it('keeps conversing with a server after it is re-paired', async () => {
|
||||
await mutation(a, 'orchestration.send', {
|
||||
from: 'term_a',
|
||||
|
||||
@@ -164,17 +164,6 @@ afterEach(async () => {
|
||||
document.body.innerHTML = ''
|
||||
})
|
||||
|
||||
describe('useAutomationHostCatalog orphan bootstrap', () => {
|
||||
it('projects the orphan entry a host answer reported', async () => {
|
||||
desktopListScoped.mockResolvedValue({ automations: [], items: [], orphanCount: 2 })
|
||||
|
||||
await renderCatalog([])
|
||||
|
||||
// Committed orphan counts arrive only through cache changes; rederive the catalog without requiring a store write.
|
||||
expect(view?.catalog.entries.map((entry) => entry.stableKey)).toContain('host:desktop:orphan')
|
||||
})
|
||||
})
|
||||
|
||||
describe('useAutomationHostCatalog on a paired web client', () => {
|
||||
const runtimeSelf = {
|
||||
authority: { kind: 'runtime', environmentId: ENVIRONMENT_ID },
|
||||
|
||||
-17
@@ -84,16 +84,6 @@ describe('the "New" marker in the transcript', () => {
|
||||
expect(row?.dataset.index).toBe(String(TRANSCRIPT_LENGTH))
|
||||
})
|
||||
|
||||
it('tells a screen reader that new messages came, in a region that was already there', () => {
|
||||
const { container, rerender } = render(chat(TRANSCRIPT_LENGTH, true))
|
||||
const region = container.querySelector('[data-native-chat-scroll] ~ [aria-live="polite"]')
|
||||
expect(region).toBeEmptyDOMElement()
|
||||
|
||||
rerender(chat(TRANSCRIPT_LENGTH, false))
|
||||
rerender(chat(TRANSCRIPT_LENGTH + 60, true))
|
||||
expect(region).toHaveTextContent('New messages arrived while you were away')
|
||||
})
|
||||
|
||||
it('is neither drawn nor announced when the reader turned it off', () => {
|
||||
const settings = useAppStore.getState().settings
|
||||
useAppStore.setState({
|
||||
@@ -137,13 +127,6 @@ describe('the "New" marker in the transcript', () => {
|
||||
const scrollTop = (container: HTMLElement): number | undefined =>
|
||||
container.querySelector('[data-native-chat-scroll]')?.scrollTop
|
||||
|
||||
it('brings a reader who was at the end to where the new rows begin', () => {
|
||||
const { container, rerender } = render(chat(TRANSCRIPT_LENGTH, true))
|
||||
returnToNewRows(rerender)
|
||||
|
||||
expect(scrollTop(container)).toBe(TRANSCRIPT_LENGTH * ROW_PITCH_PX)
|
||||
})
|
||||
|
||||
it('keeps the reader where the new rows begin while a reply is still being drawn', async () => {
|
||||
const { container, rerender } = render(chat(TRANSCRIPT_LENGTH, true))
|
||||
returnToNewRows(rerender, 1)
|
||||
|
||||
-51
@@ -66,13 +66,6 @@ const missed = (key: string, after: number, through: number) => ({
|
||||
})
|
||||
|
||||
describe('where the "New" marker draws', () => {
|
||||
it('is above the first row that came while the reader was away', () => {
|
||||
expect(nativeChatNewRowsMarkerPlacement(slotsOf(LATER), missed('answer', 2, 4))).toEqual({
|
||||
key: 'answer',
|
||||
place: 'above-row'
|
||||
})
|
||||
})
|
||||
|
||||
it("is above the turn bar when only that bar parts the row from the reader's prompt", () => {
|
||||
const asked = [row('prompt', 1, 'user'), row('answer', 2)]
|
||||
expect(
|
||||
@@ -100,11 +93,6 @@ describe('where the "New" marker draws', () => {
|
||||
).toEqual({ key: 'step', place: 'above-row' })
|
||||
}
|
||||
})
|
||||
|
||||
it('is absent when nothing came, or the row that did is gone', () => {
|
||||
expect(nativeChatNewRowsMarkerPlacement(slotsOf(LATER), null)).toBeUndefined()
|
||||
expect(nativeChatNewRowsMarkerPlacement(slotsOf(SEEN), missed('answer', 2, 4))).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
describe('useNativeChatNewRowsMarker', () => {
|
||||
@@ -141,16 +129,6 @@ describe('useNativeChatNewRowsMarker', () => {
|
||||
return view
|
||||
}
|
||||
|
||||
it('marks nothing that arrives while the reader is looking', () => {
|
||||
const view = chat(SEEN)
|
||||
view.rerender({ messages: LATER, showing: true })
|
||||
expect(view.result.current.marker).toBeUndefined()
|
||||
})
|
||||
|
||||
it('marks what a hidden chat is handed when the reader comes back to it', () => {
|
||||
expect(leaveAndReturn(SEEN, LATER).result.current.marker?.key).toBe('answer')
|
||||
})
|
||||
|
||||
it("is never above the reader's own prompt", () => {
|
||||
const sent = [...SEEN, row('next-prompt', 3, 'user'), row('answer', 4)]
|
||||
expect(leaveAndReturn(SEEN, sent).result.current.marker?.key).toBe('answer')
|
||||
@@ -176,12 +154,6 @@ describe('useNativeChatNewRowsMarker', () => {
|
||||
expect(view.result.current.marker?.key).toBe('answer')
|
||||
})
|
||||
|
||||
it('goes once the reader answers', () => {
|
||||
const view = leaveAndReturn(SEEN, LATER)
|
||||
act(() => view.result.current.dismiss())
|
||||
expect(view.result.current.marker).toBeUndefined()
|
||||
})
|
||||
|
||||
it('does not appear when the reader answered before the chat had caught up', () => {
|
||||
const view = chat(SEEN)
|
||||
view.rerender({ messages: SEEN, showing: false })
|
||||
@@ -196,13 +168,6 @@ describe('useNativeChatNewRowsMarker', () => {
|
||||
expect(view.result.current.marker?.key).toBe('answer')
|
||||
})
|
||||
|
||||
it('is arriving on the return, until the row that draws it has brought it into view', () => {
|
||||
const view = leaveAndReturn(SEEN, LATER)
|
||||
expect(view.result.current.marker?.arriving).toBe(true)
|
||||
act(() => view.result.current.marker?.onArrived())
|
||||
expect(view.result.current.marker).toMatchObject({ key: 'answer', arriving: false })
|
||||
})
|
||||
|
||||
it('stays where it is through another look away, until the reader answers', () => {
|
||||
const view = leaveAndReturn(SEEN, LATER)
|
||||
act(() => view.result.current.marker?.onArrived())
|
||||
@@ -255,14 +220,6 @@ describe('useNativeChatNewRowsMarker', () => {
|
||||
expect(view.result.current.marker?.key).toBe('held')
|
||||
})
|
||||
|
||||
it('keeps its place when the reader opens the turn that came while they were away', () => {
|
||||
const view = leaveAndReturn(ASKED, DONE, { worked: 17 })
|
||||
expect(view.result.current.marker).toMatchObject({ key: 'prompt', place: 'above-turn-bar' })
|
||||
|
||||
view.rerender({ messages: DONE, showing: true, turn: { worked: 17, expanded: true } })
|
||||
expect(view.result.current.marker).toMatchObject({ key: 'prompt', place: 'above-turn-bar' })
|
||||
})
|
||||
|
||||
it('stays through another look away after the reader shuts the turn they opened', () => {
|
||||
const shut = { worked: 17 }
|
||||
const view = leaveAndReturn(ASKED, DONE, { worked: 17, expanded: true })
|
||||
@@ -278,14 +235,6 @@ describe('useNativeChatNewRowsMarker', () => {
|
||||
const marked = (onReturn: NativeChatMessage[]) =>
|
||||
leaveAndReturn(begun, onReturn, { working: true }).result.current.marker?.key
|
||||
|
||||
it('is marked new when it grew while they were away', () => {
|
||||
expect(marked(grown)).toBe('reply')
|
||||
})
|
||||
|
||||
it('is not marked when it is as they left it', () => {
|
||||
expect(marked(begun)).toBeUndefined()
|
||||
})
|
||||
|
||||
it('gives way to the next row when it is as they left it', () => {
|
||||
expect(marked([...begun, row('more', 3)])).toBe('more')
|
||||
})
|
||||
|
||||
@@ -119,31 +119,6 @@ function renderNavigationHarness({
|
||||
return render(<NavigationHarness {...props} />)
|
||||
}
|
||||
|
||||
it('finds controls across General destinations and opens the actual setting for editing', async () => {
|
||||
const onWrite = vi.fn()
|
||||
const scroll = vi.spyOn(HTMLElement.prototype, 'scrollIntoView')
|
||||
renderNavigationHarness({ onWrite })
|
||||
expect(screen.getByRole('button', { name: /Workspace directory/i })).toBeTruthy()
|
||||
expect(screen.getByRole('button', { name: /External worktrees/i })).toBeTruthy()
|
||||
expect(screen.getByRole('switch', { name: 'Deleting a workspace' })).toBeTruthy()
|
||||
fireEvent.change(screen.getByRole('textbox', { name: 'Search settings' }), {
|
||||
target: { value: 'folder per project' }
|
||||
})
|
||||
fireEvent.click(await screen.findByRole('button', { name: /Folder per project/ }))
|
||||
expect(await screen.findByRole('switch', { name: 'Folder per project' })).toBeTruthy()
|
||||
fireEvent.change(screen.getByRole('textbox', { name: 'Search settings' }), {
|
||||
target: { value: 'minimap' }
|
||||
})
|
||||
const result = await screen.findByRole('button', { name: /Minimap/ })
|
||||
fireEvent.click(result)
|
||||
const control = await screen.findByRole('switch', { name: 'Minimap' })
|
||||
await waitFor(() =>
|
||||
expect(scroll.mock.contexts).toContain(control.closest('#general-editor-minimap'))
|
||||
)
|
||||
fireEvent.click(control)
|
||||
expect(onWrite).toHaveBeenCalledWith({ editorMinimapEnabled: false })
|
||||
})
|
||||
|
||||
it('opens an old subsection link from another child with a conflicting query, including repeated selection', async () => {
|
||||
const scroll = vi.spyOn(HTMLElement.prototype, 'scrollIntoView')
|
||||
const { container } = renderNavigationHarness({ initialQuery: 'font' })
|
||||
|
||||
-199
@@ -1,199 +0,0 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { ManagedSkillInstall } from '../../../../../shared/skill-install-contract'
|
||||
import type {
|
||||
SkillCloudPackageDetails,
|
||||
SkillCloudVersion
|
||||
} from '../../../../../shared/skill-cloud-contract'
|
||||
import { useAppStore } from '@/store/index'
|
||||
|
||||
import { SkillInstallManagementDialog } from './SkillInstallManagementDialog'
|
||||
|
||||
const DIGEST = 'a'.repeat(64)
|
||||
const ARCHIVE_SHA = 'b'.repeat(64)
|
||||
|
||||
function version(versionId: string, createdAt: string): SkillCloudVersion {
|
||||
return {
|
||||
packageId: 'pkg_1',
|
||||
versionId,
|
||||
name: 'private-skill',
|
||||
description: 'Private skill',
|
||||
packageDigest: DIGEST,
|
||||
archiveSha256: ARCHIVE_SHA,
|
||||
compressedBytes: 128,
|
||||
createdAt,
|
||||
releaseNotes: '',
|
||||
manifest: {
|
||||
schemaVersion: 1,
|
||||
packageId: 'pkg_1',
|
||||
versionId,
|
||||
name: 'private-skill',
|
||||
description: 'Private skill',
|
||||
createdAt,
|
||||
files: [],
|
||||
packageDigest: DIGEST
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function install(versionId: string): ManagedSkillInstall {
|
||||
return {
|
||||
name: 'private-skill',
|
||||
packageId: 'pkg_1',
|
||||
versionId,
|
||||
packageDigest: DIGEST,
|
||||
scope: 'global',
|
||||
destinationIdentity: 'global:local',
|
||||
destination: { scope: 'global' },
|
||||
installedAt: '2026-08-11T00:00:00.000Z',
|
||||
state: 'unchanged'
|
||||
}
|
||||
}
|
||||
|
||||
function packageDetails(versions: SkillCloudVersion[]): SkillCloudPackageDetails {
|
||||
return {
|
||||
id: 'pkg_1',
|
||||
name: 'private-skill',
|
||||
description: 'Private skill',
|
||||
createdAt: versions.at(-1)?.createdAt ?? '2026-08-11T00:00:00.000Z',
|
||||
canManage: true,
|
||||
versions
|
||||
}
|
||||
}
|
||||
|
||||
function skillsApi(
|
||||
installedInput: ManagedSkillInstall | ManagedSkillInstall[],
|
||||
versions: SkillCloudVersion[],
|
||||
details = packageDetails(versions)
|
||||
) {
|
||||
const installed = Array.isArray(installedInput) ? installedInput : [installedInput]
|
||||
let progressListener:
|
||||
| ((progress: { operationId: string; phase: 'authorizing' | 'installing' }) => void)
|
||||
| null = null
|
||||
return {
|
||||
listManagedInstalls: vi.fn().mockResolvedValue({ status: 'ok', value: installed }),
|
||||
getPackage: vi.fn().mockResolvedValue({ status: 'ok', value: details }),
|
||||
installPackageVersion: vi.fn().mockResolvedValue({
|
||||
status: 'ok',
|
||||
value: {
|
||||
operationId: 'operation_1',
|
||||
status: 'updated',
|
||||
name: installed[0]?.name ?? 'private-skill',
|
||||
packageDigest: DIGEST,
|
||||
placements: []
|
||||
}
|
||||
}),
|
||||
installBundlePackageVersion: vi.fn().mockResolvedValue({
|
||||
status: 'ok',
|
||||
value: {
|
||||
operationId: 'operation_bundle',
|
||||
packageId: 'pkg_1',
|
||||
versionId: versions[0]?.versionId ?? 'ver_1',
|
||||
bundleDigest: DIGEST,
|
||||
status: 'complete',
|
||||
skills: installed.map((skill) => ({
|
||||
skillId: skill.name,
|
||||
name: skill.name,
|
||||
digest: skill.packageDigest,
|
||||
status: 'updated',
|
||||
placements: []
|
||||
}))
|
||||
}
|
||||
}),
|
||||
removeInstall: vi.fn().mockResolvedValue({
|
||||
status: 'ok',
|
||||
value: {
|
||||
operationId: 'operation_2',
|
||||
status: 'removed',
|
||||
name: installed[0]?.name ?? 'private-skill',
|
||||
packageDigest: DIGEST,
|
||||
placements: []
|
||||
}
|
||||
}),
|
||||
revokeShare: vi.fn().mockResolvedValue({ status: 'ok', value: undefined }),
|
||||
deletePackage: vi.fn().mockResolvedValue({ status: 'ok', value: undefined }),
|
||||
cancelInstall: vi.fn().mockResolvedValue({ cancelled: true }),
|
||||
onInstallProgress: vi.fn((listener) => {
|
||||
progressListener = listener
|
||||
return () => {
|
||||
progressListener = null
|
||||
}
|
||||
}),
|
||||
emitInstallProgress: (progress: { operationId: string; phase: 'authorizing' | 'installing' }) =>
|
||||
progressListener?.(progress)
|
||||
}
|
||||
}
|
||||
|
||||
function bundleVersion(versionId: string, names: string[]): SkillCloudVersion {
|
||||
const createdAt = '2026-08-12T00:00:00.000Z'
|
||||
return {
|
||||
...version(versionId, createdAt),
|
||||
name: 'team-skills',
|
||||
manifest: {
|
||||
schemaVersion: 1,
|
||||
packageId: 'pkg_1',
|
||||
versionId,
|
||||
bundleName: 'team-skills',
|
||||
description: 'Team skills',
|
||||
createdAt,
|
||||
bundleDigest: DIGEST,
|
||||
skills: names.map((name) => ({
|
||||
id: name,
|
||||
name,
|
||||
description: `${name} description`,
|
||||
digest: DIGEST,
|
||||
files: []
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function bundleInstall(name: string, state: ManagedSkillInstall['state'] = 'unchanged') {
|
||||
return { ...install('ver_1'), name, bundleDigest: DIGEST, state }
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
useAppStore.setState({
|
||||
runtimeEnvironments: [],
|
||||
sshConnectionStates: new Map(),
|
||||
sshTargetLabels: new Map(),
|
||||
pendingSkillShareId: null
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
cleanup()
|
||||
vi.restoreAllMocks()
|
||||
Reflect.deleteProperty(window, 'api')
|
||||
})
|
||||
|
||||
describe('SkillInstallManagementDialog', () => {
|
||||
it('opens an active bundle link in the existing machine installer', async () => {
|
||||
const installed = [bundleInstall('alpha-skill'), bundleInstall('beta-skill')]
|
||||
const versions = [bundleVersion('ver_1', ['alpha-skill', 'beta-skill'])]
|
||||
const details = {
|
||||
...packageDetails(versions),
|
||||
management: {
|
||||
shares: [
|
||||
{
|
||||
id: 'share_bundle',
|
||||
url: 'https://app.orca.dev/skills/share/share_bundle',
|
||||
createdAt: '2026-08-12T00:00:00.000Z'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
const skills = skillsApi(installed, versions, details)
|
||||
const onOpenChange = vi.fn()
|
||||
Object.defineProperty(window, 'api', { configurable: true, value: { skills } })
|
||||
render(<SkillInstallManagementDialog open onOpenChange={onOpenChange} />)
|
||||
|
||||
fireEvent.click(await screen.findByRole('button', { name: /alpha-skill \+1/ }))
|
||||
fireEvent.click(await screen.findByRole('button', { name: /Install elsewhere/ }))
|
||||
|
||||
expect(onOpenChange).toHaveBeenCalledWith(false)
|
||||
expect(useAppStore.getState().pendingSkillShareId).toBe('share_bundle')
|
||||
})
|
||||
})
|
||||
@@ -58,21 +58,6 @@ function discoveryResult(
|
||||
}
|
||||
}
|
||||
|
||||
/** A root the host could not read: it reports `exists` because it cannot prove otherwise. */
|
||||
function unavailableSource(overrides: Partial<SkillDiscoverySource> = {}): SkillDiscoverySource {
|
||||
return {
|
||||
id: 'home',
|
||||
label: 'Agent skills home',
|
||||
path: '/Users/test/.agents/skills',
|
||||
sourceKind: 'home',
|
||||
providers: ['agent-skills'],
|
||||
owner: null,
|
||||
exists: true,
|
||||
skippedReason: 'unavailable',
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
|
||||
function deferred<T>(): {
|
||||
promise: Promise<T>
|
||||
resolve: (value: T) => void
|
||||
@@ -171,51 +156,6 @@ beforeEach(() => {
|
||||
})
|
||||
|
||||
describe('useInstalledAgentSkill', () => {
|
||||
// Unread roots contain unknown skills; claiming absent would offer Install for existing skills.
|
||||
|
||||
it('keeps a negative authoritative when the unread root is out of scope', async () => {
|
||||
const scan = deferred<SkillDiscoveryResult>()
|
||||
const discover = vi
|
||||
.fn<(target?: SkillDiscoveryTarget) => Promise<SkillDiscoveryResult>>()
|
||||
.mockReturnValue(scan.promise)
|
||||
Object.defineProperty(window, 'api', {
|
||||
configurable: true,
|
||||
value: { skills: { discover } }
|
||||
})
|
||||
|
||||
await renderProbe()
|
||||
// The probe asks only about home roots, so a stalled repo root proves nothing.
|
||||
scan.resolve(
|
||||
discoveryResult([], [unavailableSource({ id: 'repo', sourceKind: 'repo', path: '/repo' })])
|
||||
)
|
||||
await act(async () => {
|
||||
await scan.promise
|
||||
})
|
||||
|
||||
expect(latestState?.installed).toBe(false)
|
||||
expect(latestState?.error).toBeNull()
|
||||
})
|
||||
|
||||
it('does not flag an incomplete scan once the skill is found anyway', async () => {
|
||||
const scan = deferred<SkillDiscoveryResult>()
|
||||
const discover = vi
|
||||
.fn<(target?: SkillDiscoveryTarget) => Promise<SkillDiscoveryResult>>()
|
||||
.mockReturnValue(scan.promise)
|
||||
Object.defineProperty(window, 'api', {
|
||||
configurable: true,
|
||||
value: { skills: { discover } }
|
||||
})
|
||||
|
||||
await renderProbe()
|
||||
scan.resolve(discoveryResult([skill({ name: 'orca-linear' })], [unavailableSource()]))
|
||||
await act(async () => {
|
||||
await scan.promise
|
||||
})
|
||||
|
||||
expect(latestState?.installed).toBe(true)
|
||||
expect(latestState?.error).toBeNull()
|
||||
})
|
||||
|
||||
it('returns installed from refresh when a legacy Linear skill is discovered', async () => {
|
||||
const backgroundScan = deferred<SkillDiscoveryResult>()
|
||||
const forcedScan = deferred<SkillDiscoveryResult>()
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { projectViewCacheKey } from '../cache/cache-identity'
|
||||
import {
|
||||
createTestStore,
|
||||
mockApi,
|
||||
resetRemoteRuntimeMocks,
|
||||
runtimeEnvironmentCall
|
||||
} from '../github-slice-test-harness'
|
||||
import type { AppState } from '../../types'
|
||||
|
||||
describe('createGitHubSlice.fetchWorkItems source/error envelope', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
resetRemoteRuntimeMocks()
|
||||
runtimeEnvironmentCall.mockResolvedValue({
|
||||
id: 'rpc-1',
|
||||
ok: true,
|
||||
result: {
|
||||
items: [],
|
||||
sources: { issues: null, prs: null, originCandidate: null, upstreamCandidate: null }
|
||||
},
|
||||
_meta: { runtimeId: 'remote-runtime' }
|
||||
})
|
||||
})
|
||||
|
||||
it('optimistically patches a project field and rolls back an ok:false result', async () => {
|
||||
const store = createTestStore()
|
||||
const cacheKey = projectViewCacheKey('organization', 'acme', 1, 'view-1')
|
||||
store.setState({
|
||||
settings: { activeRuntimeEnvironmentId: null },
|
||||
projectViewCache: {
|
||||
[cacheKey]: {
|
||||
fetchedAt: 1,
|
||||
data: {
|
||||
project: {
|
||||
id: 'project-1',
|
||||
owner: 'acme',
|
||||
ownerType: 'organization',
|
||||
number: 1,
|
||||
title: 'Roadmap',
|
||||
url: 'https://github.com/orgs/acme/projects/1'
|
||||
},
|
||||
selectedView: {
|
||||
id: 'view-1',
|
||||
number: 1,
|
||||
name: 'Table',
|
||||
layout: 'TABLE_LAYOUT',
|
||||
filter: '',
|
||||
fields: [{ id: 'field-1', name: 'Notes', dataType: 'TEXT', kind: 'text' }],
|
||||
groupByFields: [],
|
||||
sortByFields: []
|
||||
},
|
||||
rows: [
|
||||
{
|
||||
id: 'row-1',
|
||||
itemType: 'ISSUE',
|
||||
content: {
|
||||
repository: 'acme/repo',
|
||||
number: 12,
|
||||
title: 'Issue',
|
||||
body: '',
|
||||
url: 'https://github.com/acme/repo/issues/12',
|
||||
state: 'OPEN',
|
||||
labels: [],
|
||||
assignees: [],
|
||||
issueType: null,
|
||||
parentIssue: null
|
||||
},
|
||||
fieldValuesByFieldId: {
|
||||
'field-1': { kind: 'text', fieldId: 'field-1', text: 'before' }
|
||||
}
|
||||
}
|
||||
],
|
||||
totalCount: 1,
|
||||
parentFieldDropped: false
|
||||
}
|
||||
}
|
||||
}
|
||||
} as unknown as Partial<AppState>)
|
||||
const mutationResult = Promise.withResolvers<{ ok: false; error: string }>()
|
||||
mockApi.gh.updateProjectItemField.mockReturnValueOnce(mutationResult.promise)
|
||||
|
||||
const mutation = store
|
||||
.getState()
|
||||
.updateProjectFieldValue(cacheKey, 'row-1', 'field-1', { kind: 'text', text: 'after' })
|
||||
expect(
|
||||
store.getState().projectViewCache[cacheKey]?.data?.rows[0]?.fieldValuesByFieldId['field-1']
|
||||
).toEqual({ kind: 'text', fieldId: 'field-1', text: 'after' })
|
||||
|
||||
mutationResult.resolve({ ok: false, error: 'rejected' })
|
||||
await expect(mutation).resolves.toEqual({ ok: false, error: 'rejected' })
|
||||
expect(
|
||||
store.getState().projectViewCache[cacheKey]?.data?.rows[0]?.fieldValuesByFieldId['field-1']
|
||||
).toEqual({ kind: 'text', fieldId: 'field-1', text: 'before' })
|
||||
})
|
||||
})
|
||||
@@ -155,18 +155,6 @@ describe('keyed record transitions', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('names deleted record keys', () => {
|
||||
const start = { t1: 'pty-1', t2: 'pty-2' }
|
||||
const next = replaceRecordEntries(start, [['t1', null]])
|
||||
expect(next).toEqual({ t2: 'pty-2' })
|
||||
expect(readRecordChanges(next, start)).toEqual({
|
||||
kind: 'addressed',
|
||||
keys: new Set(['t1']),
|
||||
added: [],
|
||||
deleted: new Set(['t1'])
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps a __proto__ key as an own entry in records and drafts', () => {
|
||||
const start = { t1: 'pty-1' }
|
||||
const replaced = replaceRecordEntries(start, [['__proto__', 'pty-2']])
|
||||
|
||||
Reference in New Issue
Block a user