test: remove 104 low-value test declarations (#37290)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-11-01 19:23:32 -08:00
committed by GitHub
co-authored by OrcaWin
parent 347e9ca5d3
commit 263d3b16aa
32 changed files with 4 additions and 1545 deletions
@@ -56,17 +56,6 @@ describe('window.orca.plugin', () => {
answer(sent.id, { output: [{ id: '1' }] })
await expect(todos).resolves.toEqual([{ id: '1' }])
})
it('hands worker posts to plugin.on by event name', () => {
const { orca, push } = mountShell()
const changed = vi.fn()
const other = vi.fn()
orca.plugin.on('todos.changed', changed)
orca.plugin.on('other', other)
push({ kind: 'message', event: 'todos.changed', payload: { count: 3 } })
expect(changed).toHaveBeenCalledWith({ count: 3 })
expect(other).not.toHaveBeenCalled()
})
})
describe('window.orca events and data', () => {
@@ -85,21 +74,4 @@ describe('window.orca events and data', () => {
push({ kind: 'event', event: 'agent.status.changed', payload: { state: 'done' } })
expect(first).toHaveBeenCalledWith({ state: 'done' })
})
it('reads storage and settings, and hears which key changed', async () => {
const { orca, requests, answer, push } = mountShell()
const value = orca.storage.get('todos')
const setting = orca.settings.get('apiUrl')
const [get, settings] = requests()
answer(get.id, { value: null })
answer(settings.id, { settings: { apiUrl: 'https://x' } })
await expect(value).resolves.toBeNull()
await expect(setting).resolves.toBe('https://x')
const changed = vi.fn()
orca.storage.onDidChange(changed)
push({ kind: 'changed', area: 'settings', key: 'apiUrl' })
push({ kind: 'changed', area: 'storage', key: 'todos' })
expect(changed).toHaveBeenCalledOnce()
expect(changed).toHaveBeenCalledWith({ key: 'todos' })
})
})
@@ -1,4 +1,3 @@
import { createHash } from 'node:crypto'
import { describe, expect, it } from 'vitest'
import {
isPluginFrameOriginUrl,
@@ -12,11 +11,6 @@ import {
const KEY = pluginFrameKey('acme.charts')
describe('plugin frame guest identity', () => {
it('derives the key as the first 16 hex chars of sha256(publisher.id)', () => {
expect(KEY).toBe(createHash('sha256').update('acme.charts').digest('hex').slice(0, 16))
expect(pluginFrameKey('acme.other')).not.toBe(KEY)
})
it('round-trips the partition and refuses look-alikes', () => {
expect(pluginFramePartition(KEY)).toBe(`persist:orca-plugin-${KEY}`)
expect(readPluginFramePartitionKey(pluginFramePartition(KEY))).toBe(KEY)
@@ -1,44 +0,0 @@
// @vitest-environment happy-dom
import { describe, expect, it } from 'vitest'
import {
exportedTypeShape,
runtimeShape,
type TypingsShape
} from '../authoring/plugin-author-typings.test-fixture'
import { buildPluginGuestShellHtml, buildPluginPanelShellHtml } from './plugin-panel-shell'
/** The `window.orca` a frame shell defines, read without leaving it on the test window. */
function frameOrca(html: string): unknown {
const script = html.match(/<script>\n([\s\S]*?)<\/script>/)?.[1] ?? ''
const transport = { send: () => {}, subscribe: () => {} }
Object.defineProperty(window, '__orcaPluginFrameTransport', {
value: transport,
configurable: true
})
window.eval(script.replaceAll('configurable: false', 'configurable: true'))
const orca: unknown = Object.getOwnPropertyDescriptor(window, 'orca')?.value
Reflect.deleteProperty(window, 'orca')
return orca
}
function without(shape: TypingsShape, keys: string[]): TypingsShape {
return typeof shape === 'string'
? shape
: Object.fromEntries(Object.entries(shape).filter(([key]) => !keys.includes(key)))
}
const typings = exportedTypeShape('orca/frame', 'OrcaFrameApi')
describe('orca-frame.d.ts matches window.orca', () => {
it('declares every member an isolated editor frame gets', () => {
expect(runtimeShape(frameOrca(buildPluginGuestShellHtml('', 'editor')))).toEqual(typings.shape)
})
it('marks optional exactly what an iframe panel lacks', () => {
const panel = runtimeShape(frameOrca(buildPluginPanelShellHtml('', 'panel')))
const absent = ['shell', 'files', 'document']
expect(typings.optional.filter((name) => !name.includes('.')).sort()).toEqual(absent.sort())
expect(panel).toEqual(without(typings.shape, absent))
})
})
@@ -17,11 +17,4 @@ describe('files.saveAs blocked extensions', () => {
])('refuses %s', (name, extension) => {
expect(blockedPluginSaveAsExtension(name)).toBe(extension)
})
it.each(['scene.excalidraw', 'chart.png', 'data.json', 'notes', '.bashrc', 'archive.tar.gz'])(
'allows %s',
(name) => {
expect(blockedPluginSaveAsExtension(name)).toBeNull()
}
)
})