diff --git a/src/commands/onboard-inference.test.ts b/src/commands/onboard-inference.test.ts index f86b69a2286c..31f79114e099 100644 --- a/src/commands/onboard-inference.test.ts +++ b/src/commands/onboard-inference.test.ts @@ -1,5 +1,5 @@ // Inference backend detection tests cover the documented ladder and login-awareness. -import { describe, expect, it } from "vitest"; +import { afterAll, describe, expect, it, vi } from "vitest"; import type { LocalCommandProbe } from "../system-agent/probes.js"; import { ANTHROPIC_API_DEFAULT_MODEL_REF, @@ -7,6 +7,55 @@ import { detectInferenceBackends, } from "./onboard-inference.js"; +const emptyPluginMetadataSnapshot = vi.hoisted(() => ({ + policyHash: "onboard-inference-test-empty-plugin-policy", + configFingerprint: "onboard-inference-test-empty-plugin-metadata", + index: { + version: 1, + hostContractVersion: "test", + compatRegistryVersion: "test", + migrationVersion: 1, + policyHash: "onboard-inference-test-empty-plugin-policy", + generatedAtMs: 0, + installRecords: {}, + plugins: [], + diagnostics: [], + }, + registryDiagnostics: [], + manifestRegistry: { plugins: [], diagnostics: [] }, + plugins: [], + diagnostics: [], + byPluginId: new Map(), + normalizePluginId: (pluginId: string) => pluginId, + owners: { + channels: new Map(), + channelConfigs: new Map(), + providers: new Map(), + modelCatalogProviders: new Map(), + cliBackends: new Map(), + setupProviders: new Map(), + commandAliases: new Map(), + contracts: new Map(), + }, + metrics: { + registrySnapshotMs: 0, + manifestRegistryMs: 0, + ownerMapsMs: 0, + totalMs: 0, + indexPluginCount: 0, + manifestPluginCount: 0, + }, +})); + +vi.mock("../plugins/current-plugin-metadata-snapshot.js", () => ({ + getCurrentPluginMetadataSnapshot: () => emptyPluginMetadataSnapshot, +})); + +afterAll(() => { + vi.doUnmock("../plugins/current-plugin-metadata-snapshot.js"); + vi.resetModules(); +}); + function probeDeps(found: Record) { return async (command: string): Promise => ({ command,