// @vitest-environment happy-dom import { afterEach, describe, expect, it, vi } from 'vitest' import { buildPluginPanelShellHtml } from './plugin-panel-shell' type Disposable = { dispose: () => void } type FrameOrca = { on: (event: string, handler: (payload: unknown) => unknown) => Disposable plugin: { request: (name: string, input?: unknown, options?: { timeoutMs?: number }) => Promise on: (event: string, handler: (payload: unknown) => unknown) => Disposable } storage: { get: (key: string) => Promise set: (key: string, value: unknown) => Promise onDidChange: (handler: (change: { key: string }) => void) => Disposable } settings: { get: (key?: string) => Promise } } const realParent = window.parent afterEach(() => { Object.defineProperty(window, 'parent', { value: realParent, configurable: true }) }) function mountShell() { const parent = { postMessage: vi.fn() } Object.defineProperty(window, 'parent', { value: parent, configurable: true }) const script = buildPluginPanelShellHtml('
').match( /