FN-8220: mock daemon model runtime setup

Align daemon startup mocks with the model runtime initialization path.

- Add the auth-storage setModelRuntime mock.
- Stub the Fusion model registry factory to use the shared test registry.

Files changed:
 packages/cli/src/commands/__tests__/daemon.test.ts | 9 +++++++++
 1 file changed, 9 insertions(+)

Fusion-Task-Id: FN-8220

Fusion-Task-Lineage: 6e00980f-2e24-4502-a4d8-e91849df33b9

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
This commit is contained in:
gsxdsm
2026-07-17 11:22:38 -07:00
parent 5acea6c0cf
commit b686fbd61d

View File

@@ -342,6 +342,7 @@ const mocks = vi.hoisted(() => {
set: vi.fn(),
remove: vi.fn(),
get: vi.fn(),
setModelRuntime: vi.fn(),
};
const modelRegistry = {
@@ -350,6 +351,12 @@ const mocks = vi.hoisted(() => {
refresh: vi.fn(),
};
/*
FNXC:CliTests 2026-07-16-10:25:
pi 0.80.8 made the real registry factory create a ModelRuntime and call authStorage.setModelRuntime. Daemon startup tests must bypass that runtime path and bind provider registration to this shared model registry.
*/
const createFusionModelRegistryMock = vi.fn(async () => modelRegistry);
const refreshAllCustomProviderModels = vi.fn().mockResolvedValue({ refreshed: 0, failed: 0, skipped: 0 });
const createSkillsAdapterMock = vi.fn().mockReturnValue(undefined);
@@ -503,6 +510,7 @@ const mocks = vi.hoisted(() => {
processAndAuditInsightExtractionMock,
authStorage,
modelRegistry,
createFusionModelRegistryMock,
refreshAllCustomProviderModels,
createSkillsAdapterMock,
reset() {
@@ -591,6 +599,7 @@ vi.mock("@fusion/engine", async (importOriginal) => {
const { createCliEngineMock } = await import("../../test/mockCoreEngine");
return createCliEngineMock(() => importOriginal<typeof import("@fusion/engine")>(), {
createFusionAuthStorage: vi.fn(() => mocks.authStorage),
createFusionModelRegistry: mocks.createFusionModelRegistryMock,
ProjectEngine: mocks.projectEngineCtor,
ProjectEngineManager: vi.fn().mockImplementation(function (centralCore: any, options: any) {
const engines = new Map<string, any>();