mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 19:07:41 +00:00
test: remove synthetic availability and shallow helper examples (#43207)
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
import { delimiter } from 'node:path'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { getDefaultSettings } from '../../../../shared/orca-profiles/constants'
|
||||
import { structuredAgentChatProgramNeedsInstall } from './structured-agent-availability'
|
||||
|
||||
const pathEntries = vi.hoisted((): { current: string[] } => ({ current: [] }))
|
||||
|
||||
vi.mock('./structured-agent-launch-support', () => ({
|
||||
resolveHostStructuredAgentLaunchEnvironment: async () => ({})
|
||||
}))
|
||||
vi.mock('../installation/structured-agent-runtime-metadata', () => ({
|
||||
structuredAgentRuntimeMetadata: (agent: string) => ({
|
||||
definition: { agent },
|
||||
supportsLocation: () => true,
|
||||
chatProgram: {
|
||||
resolve: () => ({ command: agent, env: { PATH: pathEntries.current.join(delimiter) } }),
|
||||
installable: () => true
|
||||
}
|
||||
})
|
||||
}))
|
||||
|
||||
const runtime = { requireStore: () => ({ getSettings: () => getDefaultSettings('/home/test') }) }
|
||||
|
||||
describe('structuredAgentChatProgramNeedsInstall', () => {
|
||||
it('offers the install when PATH only adds an unexpanded home entry', async () => {
|
||||
pathEntries.current = ['/usr/bin', '~/.dotnet/tools']
|
||||
await expect(structuredAgentChatProgramNeedsInstall('codex', runtime)).resolves.toBe(true)
|
||||
})
|
||||
})
|
||||
@@ -3,13 +3,6 @@ import { getGeneratedWorktreeCreateCandidate } from './worktree-create-candidate
|
||||
import { isGeneratedWorktreeCreateName } from '../../../shared/new-workspace/worktree-create-retry-policy'
|
||||
|
||||
describe('generated worktree create candidates', () => {
|
||||
it('advances canonical tiers instead of nesting collision suffixes', () => {
|
||||
expect(getGeneratedWorktreeCreateCandidate('nautilus-2', 1)).toBe('nautilus-2')
|
||||
expect(getGeneratedWorktreeCreateCandidate('nautilus-2', 2)).toBe('nautilus-3')
|
||||
expect(getGeneratedWorktreeCreateCandidate('nautilus-2', 99)).toBe('nautilus-100')
|
||||
expect(getGeneratedWorktreeCreateCandidate('nautilus', 1, 100)).toBe('nautilus-101')
|
||||
})
|
||||
|
||||
it('canonicalizes legacy nested generated suffixes', () => {
|
||||
expect(isGeneratedWorktreeCreateName('nautilus')).toBe(true)
|
||||
expect(isGeneratedWorktreeCreateName('nautilus-2')).toBe(true)
|
||||
|
||||
@@ -5,30 +5,11 @@ import {
|
||||
NATIVE_CHAT_VISUAL_PONG_TYPE,
|
||||
NATIVE_CHAT_VISUAL_READER_SCROLL_TYPE,
|
||||
NATIVE_CHAT_VISUAL_SIZE_TYPE,
|
||||
buildNativeChatVisualDocument,
|
||||
nativeChatVisualThemeCss,
|
||||
readNativeChatVisualFrameMessage,
|
||||
readNativeChatVisualPong
|
||||
} from './native-chat-visual-shell'
|
||||
|
||||
const theme = {
|
||||
colorScheme: 'dark' as const,
|
||||
tokens: { '--background': 'oklch(0.2 0 0)', '--chart-1': '#123456' }
|
||||
}
|
||||
|
||||
describe('buildNativeChatVisualDocument', () => {
|
||||
const html = '<!doctype html><html><head><title>x</title></head><body><p>hi</p></body></html>'
|
||||
const document = buildNativeChatVisualDocument({ html, channel: 'abc123', theme })
|
||||
|
||||
it('puts the CSP before anything the visual wrote', () => {
|
||||
const cspAt = document.indexOf('http-equiv="Content-Security-Policy"')
|
||||
expect(cspAt).toBeGreaterThan(0)
|
||||
expect(cspAt).toBeLessThan(document.indexOf('<title>x</title>'))
|
||||
expect(cspAt).toBeLessThan(document.indexOf('<script>'))
|
||||
expect(document.endsWith(html)).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('nativeChatVisualThemeCss', () => {
|
||||
it('drops structural characters and invalid names so a value cannot escape the rule', () => {
|
||||
const css = nativeChatVisualThemeCss({
|
||||
|
||||
Reference in New Issue
Block a user