From 58b6fa3ae1f8308e94657b2b512534d6e0f4c1b7 Mon Sep 17 00:00:00 2001 From: imccyu <276526105+imccyu@users.noreply.github.com> Date: Wed, 12 Aug 2026 02:16:07 +0800 Subject: [PATCH] fix: test constract --- .../tests/apply-inject.client.spec.tsx | 2 +- .../tests/assembly-surfaces.client.spec.tsx | 8 ++++---- .../ui-conversation/tests/chat-apply.client.spec.tsx | 2 +- .../ui-tool/tests/assembly-surfaces.client.spec.tsx | 2 +- .../ui-tool/tests/toolview-slot.client.spec.tsx | 4 ++-- scripts/oxlint-contract.spec.ts | 11 +++++++---- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/packages/client/ui-conversation/tests/apply-inject.client.spec.tsx b/packages/client/ui-conversation/tests/apply-inject.client.spec.tsx index 2017d84498..4e637d9f81 100644 --- a/packages/client/ui-conversation/tests/apply-inject.client.spec.tsx +++ b/packages/client/ui-conversation/tests/apply-inject.client.spec.tsx @@ -47,7 +47,7 @@ function sessionFakeFor() { async function bench() { const runtime = await SlotTestRuntime.create() - runtime.provide('connection', { api: { settings: {} }, isLoopback: false } as never) + runtime.provide('connection', { api: { settings: {} }, isLoopback: false }) // The plugin injects both; these specs exercise no settings path. runtime.provide('remote', { $on: () => () => {} }) runtime.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never) diff --git a/packages/client/ui-conversation/tests/assembly-surfaces.client.spec.tsx b/packages/client/ui-conversation/tests/assembly-surfaces.client.spec.tsx index 9d4004f8c0..65f0c49ea2 100644 --- a/packages/client/ui-conversation/tests/assembly-surfaces.client.spec.tsx +++ b/packages/client/ui-conversation/tests/assembly-surfaces.client.spec.tsx @@ -50,7 +50,7 @@ function WorkspaceProbe({ open }: EmptyWorkspaceOwnerProps) { async function bench(opts?: { blank?: boolean }) { const runtime = await SlotTestRuntime.create() - runtime.provide('connection', { api: { settings: {} }, isLoopback: false } as never) + runtime.provide('connection', { api: { settings: {} }, isLoopback: false }) // The plugin injects both; these specs exercise no settings path. runtime.provide('remote', { $on: () => () => {} }) runtime.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never) @@ -78,7 +78,7 @@ async function bench(opts?: { blank?: boolean }) { describe('resident composer', () => { it('renders the locked view state while no session exists at all', async () => { const runtime = await SlotTestRuntime.create() - runtime.provide('connection', { api: { settings: {} }, isLoopback: false } as never) + runtime.provide('connection', { api: { settings: {} }, isLoopback: false }) // The plugin injects both; these specs exercise no settings path. runtime.provide('remote', { $on: () => () => {} }) runtime.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never) @@ -108,7 +108,7 @@ describe('resident composer', () => { it('keeps the complete Hero tree mounted when the first Workspace session appears', async () => { const runtime = await SlotTestRuntime.create() - runtime.provide('connection', { api: { settings: {} }, isLoopback: false } as never) + runtime.provide('connection', { api: { settings: {} }, isLoopback: false }) // The plugin injects both; these specs exercise no settings path. runtime.provide('remote', { $on: () => () => {} }) runtime.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never) @@ -177,7 +177,7 @@ describe('resident composer', () => { describe('prompt rejection through the assembled composer', () => { it('renders the promptError alert strip and keeps the draft in the machine', async () => { const runtime = await SlotTestRuntime.create() - runtime.provide('connection', { api: { settings: {} }, isLoopback: false } as never) + runtime.provide('connection', { api: { settings: {} }, isLoopback: false }) // The plugin injects both; these specs exercise no settings path. runtime.provide('remote', { $on: () => () => {} }) runtime.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never) diff --git a/packages/client/ui-conversation/tests/chat-apply.client.spec.tsx b/packages/client/ui-conversation/tests/chat-apply.client.spec.tsx index 0ebb710311..fde0896542 100644 --- a/packages/client/ui-conversation/tests/chat-apply.client.spec.tsx +++ b/packages/client/ui-conversation/tests/chat-apply.client.spec.tsx @@ -21,7 +21,7 @@ const CHILD = 'child-1' as SessionId async function bench() { const runtime = await SlotTestRuntime.create() - runtime.provide('connection', { api: { settings: {} }, isLoopback: false } as never) + runtime.provide('connection', { api: { settings: {} }, isLoopback: false }) // The plugin injects both; these specs exercise no settings path. runtime.provide('remote', { $on: () => () => {} }) runtime.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never) diff --git a/packages/client/ui-tool/tests/assembly-surfaces.client.spec.tsx b/packages/client/ui-tool/tests/assembly-surfaces.client.spec.tsx index 668b1bda89..c9e5486da2 100644 --- a/packages/client/ui-tool/tests/assembly-surfaces.client.spec.tsx +++ b/packages/client/ui-tool/tests/assembly-surfaces.client.spec.tsx @@ -68,7 +68,7 @@ const LAYOUT_CHILDREN = { async function bench(nodes: ToolResultNode[]) { const runtime = await SlotTestRuntime.create() - runtime.provide('connection', { api: { settings: {} }, isLoopback: false } as never) + runtime.provide('connection', { api: { settings: {} }, isLoopback: false }) // ui-theme's Appearance row binds a durable scope through these two. runtime.provide('remote', { $on: () => () => {} }) runtime.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never) diff --git a/packages/client/ui-tool/tests/toolview-slot.client.spec.tsx b/packages/client/ui-tool/tests/toolview-slot.client.spec.tsx index afd714c74f..4fa5dbeb5d 100644 --- a/packages/client/ui-tool/tests/toolview-slot.client.spec.tsx +++ b/packages/client/ui-tool/tests/toolview-slot.client.spec.tsx @@ -64,7 +64,7 @@ const LAYOUT_CHILDREN = { */ async function bench(nodes: ToolResultNode[]) { const runtime = await SlotTestRuntime.create() - runtime.provide('connection', { api: { settings: {} }, isLoopback: false } as never) + runtime.provide('connection', { api: { settings: {} }, isLoopback: false }) // ui-theme's Appearance row binds a durable scope through these two. runtime.provide('remote', { $on: () => () => {} }) runtime.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never) @@ -200,7 +200,7 @@ describe('keyed toolview hole through the real machinery', () => { describe('registrant declaration injection', () => { it('runs a registrant before ui-tool and waits on the actual toolview declaration', async () => { const runtime = await SlotTestRuntime.create() - runtime.provide('connection', { api: { settings: {} }, isLoopback: false } as never) + runtime.provide('connection', { api: { settings: {} }, isLoopback: false }) // ui-theme's Appearance row binds a durable scope through these two. runtime.provide('remote', { $on: () => () => {} }) runtime.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never) diff --git a/scripts/oxlint-contract.spec.ts b/scripts/oxlint-contract.spec.ts index 5126fe0986..d9308e2276 100644 --- a/scripts/oxlint-contract.spec.ts +++ b/scripts/oxlint-contract.spec.ts @@ -53,7 +53,9 @@ describe('Oxlint executable contract', () => { ['host package source', 'packages/fs/fs-policy/src', 'packages/fs/fs-policy/tsconfig.json'], ['host package test', 'packages/fs/fs-policy/tests', 'tsconfig.host.json'], ['client package source', 'packages/client/ui-primitives/src', 'packages/client/ui-primitives/tsconfig.json'], - ['client package test', 'packages/client/ui-trajectory/tests', 'tsconfig.client.json'], + // A test under packages/client states its face in the filename, so the + // probe carries the Client suffix to reach the Client aggregate. + ['client package test', 'packages/client/ui-trajectory/tests', 'tsconfig.client.json', '.client.ts'], ['example', 'examples/headless-agent/tests', 'tsconfig.host.json'], ['website', 'website', 'tsconfig.host.json'], ] as const @@ -66,8 +68,8 @@ probePromise() try { const paths: Array = [] - for (const [label, parent, tsconfig] of probes) { - const path = join(repositoryRoot, parent, `oxlint-contract-${suffix}.ts`) + for (const [label, parent, tsconfig, extension = '.ts'] of probes) { + const path = join(repositoryRoot, parent, `oxlint-contract-${suffix}${extension}`) await writeFile(path, source) paths.push([label, relative(repositoryRoot, path), tsconfig]) } @@ -98,7 +100,8 @@ probePromise() expect(output).not.toContain('Unmatched file:') } finally { await Promise.all([ - ...probes.map(([, parent]) => rm(join(repositoryRoot, parent, `oxlint-contract-${suffix}.ts`), { force: true })), + ...probes.map(([, parent, , extension = '.ts']) => + rm(join(repositoryRoot, parent, `oxlint-contract-${suffix}${extension}`), { force: true })), rm(configPath, { force: true }), ]) }