mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 10:27:33 +00:00
test: remove weak transcript, port and icon-theme cases (#42387)
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -4507,7 +4507,6 @@
|
||||
"src/renderer/src/components/mobile/use-mobile-page-paired-devices.test.ts": 475,
|
||||
"src/renderer/src/components/native-chat-recovery/offers/native-chat-resume-failed-chat-watch.test.ts": 1954,
|
||||
"src/renderer/src/components/native-chat-recovery/integration/native-chat-resume-finished-run.test.tsx": 4173,
|
||||
"src/renderer/src/components/native-chat/tools/tasks/NativeChatBackgroundTaskRun.test.tsx": 242,
|
||||
"src/renderer/src/components/native-chat/tools/tasks/NativeChatBackgroundTasksStatus.test.tsx": 782,
|
||||
"src/renderer/src/components/native-chat/markdown/code/NativeChatCodeBlock.load-failure.test.tsx": 594,
|
||||
"src/renderer/src/components/native-chat/markdown/code/NativeChatCodeBlock.test.tsx": 2775,
|
||||
@@ -4613,7 +4612,6 @@
|
||||
"src/renderer/src/components/native-chat/subagents/native-chat-subagent-handoff-copy-budget.test.ts": 362,
|
||||
"src/renderer/src/components/native-chat/pane/routing/native-chat-tab-directory.test.ts": 304,
|
||||
"src/renderer/src/components/native-chat/native-chat-task-list-state.test.ts": 62,
|
||||
"src/renderer/src/components/native-chat/native-chat-thread-goal-rows.test.ts": 50,
|
||||
"src/renderer/src/components/native-chat/tools/runs/native-chat-tool-fold.test.ts": 65,
|
||||
"src/renderer/src/components/native-chat/conversation/slots/native-chat-transcript-slots.test.ts": 355,
|
||||
"src/renderer/src/components/native-chat/tools/diffs/native-chat-turn-diffs.test.ts": 340,
|
||||
|
||||
@@ -48,34 +48,6 @@ async function iconPlugin(svgs: Record<string, string>): Promise<ValidDiscovered
|
||||
}
|
||||
}
|
||||
|
||||
it('lists metadata and reads a theme only when it is loaded', async () => {
|
||||
const plugin = await iconPlugin({
|
||||
'folder.svg': '<svg viewBox="0 0 1 1"><path fill="currentColor" d="M0 0h1v1z"/></svg>',
|
||||
'ts.svg': '<svg viewBox="0 0 1 1"><rect width="1" height="1" fill="#3178c6"/></svg>'
|
||||
})
|
||||
const registry = new PluginIconThemeRegistry(new PluginContentVerifier())
|
||||
await registry.reconcile([plugin], () => true)
|
||||
|
||||
expect(registry.list()).toEqual([
|
||||
{
|
||||
id: 'plugin:samples.minimal-icons/minimal',
|
||||
pluginKey: 'samples.minimal-icons',
|
||||
label: 'Minimal',
|
||||
revision: expect.stringMatching(/^[0-9a-f]{32}$/)
|
||||
}
|
||||
])
|
||||
const theme = await registry.load('plugin:samples.minimal-icons/minimal')
|
||||
expect(theme?.svgs).toHaveLength(2)
|
||||
expect(theme?.svgs[theme.icons.folder ?? -1]).toContain('currentColor')
|
||||
expect(theme?.svgs[theme.fileExtensions.ts ?? -1]).toContain('#3178c6')
|
||||
await expect(registry.load('plugin:samples.other/x')).resolves.toBeNull()
|
||||
|
||||
// An update that changes only SVG bytes keeps id and title but installs a new tree hash.
|
||||
const revision = registry.list()[0]?.revision
|
||||
await registry.reconcile([{ ...plugin, contentHash: 'a'.repeat(64) }], () => true)
|
||||
expect(registry.list()[0]?.revision).not.toBe(revision)
|
||||
})
|
||||
|
||||
it('fails a load whose file is not an SVG document and forgets themes once disabled', async () => {
|
||||
const plugin = await iconPlugin({
|
||||
'folder.svg': '<!DOCTYPE svg [<!ENTITY x "y">]><svg/>',
|
||||
|
||||
+1
-59
@@ -1,5 +1,4 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import * as imageSources from '../../markdown/native-chat-markdown-image-sources'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { nativeChatAgentRowWords } from '../../messages/rows/native-chat-message-row-words'
|
||||
|
||||
import type { NativeChatMessage } from '../../../../../../shared/native-chat/native-chat-types'
|
||||
@@ -137,53 +136,6 @@ describe('transcript slots', () => {
|
||||
).toEqual(retained ? [{ type: 'image-ref', path: '/tmp/p.png' }] : [])
|
||||
})
|
||||
|
||||
it.each([1000, 10000])(
|
||||
'keeps completed image responses stable on the production streaming trigger at %i rows',
|
||||
(count) => {
|
||||
const generated: NativeChatMessage = {
|
||||
...text('image', ''),
|
||||
blocks: [
|
||||
{ type: 'text', text: 'Generated image', presentation: 'generated-image' },
|
||||
{ type: 'image-ref', path: '/tmp/p.png' }
|
||||
]
|
||||
}
|
||||
const rows = [
|
||||
text('u', 'Generate.', 'user'),
|
||||
generated,
|
||||
...Array.from({ length: count - 3 }, (_, index) => text(`work-${index}`, 'Working.')),
|
||||
text('answer', 'Finished.'),
|
||||
text('live', 'Next.', 'user'),
|
||||
text('stream', 'Streaming.')
|
||||
]
|
||||
const overrides = {
|
||||
turnStatuses: {
|
||||
active: null,
|
||||
completedByTurn: { u: { startedAt: 1, thinking: false, workedSeconds: 4 } }
|
||||
}
|
||||
}
|
||||
const reads = vi.spyOn(imageSources, 'nativeChatMarkdownImageSources')
|
||||
try {
|
||||
const first = build(rows, overrides)
|
||||
expect(reads).toHaveBeenCalledTimes(1)
|
||||
reads.mockClear()
|
||||
const next = build([...rows.slice(0, -1), text('stream', 'Streaming more.')], overrides)
|
||||
// Only live text changed: settled answers need zero source discovery and preserve row identity.
|
||||
expect(reads).not.toHaveBeenCalled()
|
||||
expect(
|
||||
next
|
||||
.filter((slot) => slot.turnKey === 'u')
|
||||
.every(
|
||||
(slot) =>
|
||||
slot.message ===
|
||||
first.find((before) => before.message.id === slot.message.id)?.message
|
||||
)
|
||||
).toBe(true)
|
||||
} finally {
|
||||
reads.mockRestore()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
it("hangs response controls only above the person's next message, never on the last row", () => {
|
||||
const visualReply = text('visual', 'Here is the trend.\n\n::orca-visual{file="trend.html"}')
|
||||
const hangs = (messages: NativeChatMessage[]) =>
|
||||
@@ -321,16 +273,6 @@ describe('transcript slots', () => {
|
||||
expect(holder(new Set())).toEqual(['a-image'])
|
||||
expect(holder(new Set(['A']))).toEqual(['a-text'])
|
||||
})
|
||||
|
||||
it('keeps a message whose only content is a turn status under it', () => {
|
||||
const status: NativeChatTurnStatus = { startedAt: 1, thinking: false, workedSeconds: 4 }
|
||||
const slots = build([text('u', '', 'user')], {
|
||||
liveTurnKey: 'u',
|
||||
turnStatuses: { active: status, completedByTurn: {} }
|
||||
})
|
||||
expect(slots).toHaveLength(1)
|
||||
expect(slots[0]?.status).toBe(status)
|
||||
})
|
||||
})
|
||||
|
||||
// Host ownership, not nearest prompt position, controls turn folds, bars and liveness.
|
||||
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import '@testing-library/jest-dom/vitest'
|
||||
|
||||
import { cleanup } from '@testing-library/react'
|
||||
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import type { NativeChatBackgroundTaskBlock } from '../../../../../../shared/native-chat/native-chat-types'
|
||||
import { deriveNativeChatRowContent } from '../../../../../../shared/native-chat/transcript/row-content/native-chat-row-content'
|
||||
|
||||
afterEach(cleanup)
|
||||
|
||||
function task(
|
||||
overrides: Partial<NativeChatBackgroundTaskBlock> = {}
|
||||
): NativeChatBackgroundTaskBlock {
|
||||
return {
|
||||
type: 'background-task',
|
||||
taskId: 'byjnee2no',
|
||||
kind: 'command',
|
||||
label: 'Wait for the verification verdict',
|
||||
state: 'working',
|
||||
startedAt: 1_000,
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
|
||||
describe('background task rows in a transcript message', () => {
|
||||
it('drops the frozen twin the block replaces, and keeps real prose', () => {
|
||||
const block = task({ state: 'blocked', summary: 'it failed' })
|
||||
const content = deriveNativeChatRowContent([
|
||||
{ type: 'text', text: 'here is what happened' },
|
||||
{ type: 'text', text: 'it failed' },
|
||||
block
|
||||
])
|
||||
expect(content.markdown).toBe('here is what happened')
|
||||
expect(content.backgroundTasks).toEqual([block])
|
||||
})
|
||||
})
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
} from '@/lib/workspace-ports/workspace-port-urls'
|
||||
|
||||
import { getLocalWorkspacePortSections } from './local-workspace-port-sections'
|
||||
import { mergeWorkspacePortScans } from '@/lib/workspace-ports/workspace-port-actions'
|
||||
|
||||
const workspacePort: WorkspacePort = {
|
||||
id: '127.0.0.1:63468:1234',
|
||||
@@ -87,31 +86,6 @@ describe('PortsPanel runtime routing', () => {
|
||||
expect(sections.externalPorts.map((port) => port.kind)).toEqual(['external', 'external'])
|
||||
})
|
||||
|
||||
it('merges local and runtime scans with host-prefixed row ids', () => {
|
||||
const runtimePort: WorkspacePort = {
|
||||
...workspacePort,
|
||||
id: workspacePort.id,
|
||||
port: 3000,
|
||||
owner: {
|
||||
...workspacePort.owner,
|
||||
repoId: 'runtime-repo',
|
||||
worktreeId: 'runtime-repo::/srv/app',
|
||||
displayName: 'runtime app',
|
||||
path: '/srv/app'
|
||||
}
|
||||
}
|
||||
|
||||
const merged = mergeWorkspacePortScans({
|
||||
'local:all': { ...emptyScan, scannedAt: 10, ports: [workspacePort] },
|
||||
'environment:env-1:all': { ...emptyScan, scannedAt: 20, ports: [runtimePort] }
|
||||
})
|
||||
|
||||
expect(merged).toMatchObject({ platform: 'unknown', scannedAt: 20 })
|
||||
expect(
|
||||
merged?.ports.map((port) => (port.kind === 'workspace' ? port.owner.worktreeId : null))
|
||||
).toEqual(['runtime-repo::/srv/app', 'repo::/workspace/app'])
|
||||
})
|
||||
|
||||
it('prefers advertisedUrl over the OS-derived host:port', () => {
|
||||
const advertised: WorkspacePort = {
|
||||
...workspacePort,
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { NativeChatMessage } from '../../native-chat-types'
|
||||
import { omitNativeChatThreadGoalRows } from './native-chat-thread-goal-rows'
|
||||
|
||||
const PAYLOAD = { head: '{}', byteLength: 2, digest: 'd'.repeat(64), truncated: false }
|
||||
|
||||
function frameRow(id: string, provider: string, kind: string): NativeChatMessage {
|
||||
return {
|
||||
id,
|
||||
role: 'system',
|
||||
timestamp: 0,
|
||||
source: 'transcript',
|
||||
blocks: [{ type: 'text', text: id, providerFrame: { provider, kind, payload: PAYLOAD } }]
|
||||
}
|
||||
}
|
||||
|
||||
describe('omitNativeChatThreadGoalRows', () => {
|
||||
it('keeps a same-named frame from another provider', () => {
|
||||
const other = frameRow('other', 'claude', 'notification:thread/goal/updated')
|
||||
expect(omitNativeChatThreadGoalRows([other])).toEqual([other])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user