feat(FN-3044): add canonical mock helpers and migrate representative test s
This merge introduces canonical mock helper modules across the dashboard and engine packages, and migrates representative test suites to use them for consistency. The changes add four new mock helpers (`mockApi.ts`, `mockLucide.ts`, `mockCore.ts`, `mockCoreEngine.ts`) and harden the API mock proxy's Fusion-Task-Id: FN-3044
This commit is contained in:
27
packages/dashboard/src/test/mockCoreEngine.ts
Normal file
27
packages/dashboard/src/test/mockCoreEngine.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Canonical @fusion/core and @fusion/engine mock helpers for dashboard server tests.
|
||||
*
|
||||
* Add new mocked exports here first before duplicating large per-suite mock objects.
|
||||
*/
|
||||
import { vi } from "vitest";
|
||||
|
||||
type AnyModule = Record<string, unknown>;
|
||||
|
||||
export async function createCoreMock(
|
||||
importActual: () => Promise<AnyModule>,
|
||||
overrides: AnyModule = {},
|
||||
): Promise<AnyModule> {
|
||||
const actual = await importActual();
|
||||
return {
|
||||
...actual,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
export function createEngineMock(overrides: AnyModule = {}): AnyModule {
|
||||
return {
|
||||
createFnAgent: vi.fn(),
|
||||
promptWithFallback: vi.fn(),
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user