From 526aaf8d65987acf0df63daedc6023098425214c Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Fri, 17 Jul 2026 11:05:02 -0700 Subject: [PATCH] FN-8218: stub model registry runtime initialization in serve tests Keep serve command tests compatible with async ModelRuntime initialization. - Add setModelRuntime to the auth storage mock - Mock createFusionModelRegistry with the shared registry fixture Files changed: packages/cli/src/commands/__tests__/serve.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) Fusion-Task-Id: FN-8218 Fusion-Task-Lineage: dcbba740-e363-4b17-8eba-00c399343d16 Co-authored-by: Fusion (runfusion.ai) --- packages/cli/src/commands/__tests__/serve.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/cli/src/commands/__tests__/serve.test.ts b/packages/cli/src/commands/__tests__/serve.test.ts index 575b527ec5..6e75573cef 100644 --- a/packages/cli/src/commands/__tests__/serve.test.ts +++ b/packages/cli/src/commands/__tests__/serve.test.ts @@ -396,6 +396,7 @@ const mocks = vi.hoisted(() => { set: vi.fn(), remove: vi.fn(), get: vi.fn(), + setModelRuntime: vi.fn(), }; const modelRegistry = { @@ -403,6 +404,13 @@ const mocks = vi.hoisted(() => { registerProvider: vi.fn(), refresh: vi.fn(), }; + /* + FNXC:CliTests 2026-07-16-10:10: + pi 0.80.8 moved model initialization into async ModelRuntime, so the real + registry factory calls authStorage.setModelRuntime. Stub that factory here to + keep provider-registration assertions bound to the shared mock registry. + */ + const createFusionModelRegistryMock = vi.fn(async () => modelRegistry); const refreshAllCustomProviderModels = vi.fn().mockResolvedValue({ refreshed: 0, failed: 0, skipped: 0 }); const createSkillsAdapterMock = vi.fn().mockReturnValue(undefined); @@ -597,6 +605,7 @@ const mocks = vi.hoisted(() => { processAndAuditInsightExtractionMock, authStorage, modelRegistry, + createFusionModelRegistryMock, refreshAllCustomProviderModels, createSkillsAdapterMock, globalSettingsGetSettings, @@ -687,6 +696,7 @@ vi.mock("@fusion/engine", async (importOriginal) => { const { createCliEngineMock } = await import("../../test/mockCoreEngine"); return createCliEngineMock(() => importOriginal(), { createFusionAuthStorage: vi.fn(() => mocks.authStorage), + createFusionModelRegistry: mocks.createFusionModelRegistryMock, ProjectEngine: mocks.projectEngineCtor, ProjectEngineManager: vi.fn().mockImplementation(function (centralCore: any, options: any) { const engines = new Map();