mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
test: type manifest catalog mock
This commit is contained in:
@@ -5,15 +5,17 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite
|
||||
import { loadSessionStore, saveSessionStore, type SessionEntry } from "../config/sessions.js";
|
||||
import { CURRENT_SESSION_VERSION } from "../config/sessions/version.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import type { loadManifestModelCatalog } from "./model-catalog.js";
|
||||
|
||||
type ProviderModelNormalizationParams = { provider: string; context: { modelId: string } };
|
||||
type LoadManifestModelCatalogParams = Parameters<typeof loadManifestModelCatalog>[0];
|
||||
|
||||
const state = vi.hoisted(() => ({
|
||||
cfg: undefined as OpenClawConfig | undefined,
|
||||
workspaceDir: undefined as string | undefined,
|
||||
agentDir: undefined as string | undefined,
|
||||
runAgentAttemptMock: vi.fn(),
|
||||
loadManifestModelCatalogMock: vi.fn(() => []),
|
||||
loadManifestModelCatalogMock: vi.fn((_params: LoadManifestModelCatalogParams) => []),
|
||||
normalizeProviderModelIdWithRuntimeMock: vi.fn(
|
||||
(_params: ProviderModelNormalizationParams) => undefined,
|
||||
),
|
||||
@@ -57,7 +59,8 @@ vi.mock("../plugins/manifest-contract-eligibility.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("./model-catalog.js", () => ({
|
||||
loadManifestModelCatalog: (...args: unknown[]) => state.loadManifestModelCatalogMock(...args),
|
||||
loadManifestModelCatalog: (params: LoadManifestModelCatalogParams) =>
|
||||
state.loadManifestModelCatalogMock(params),
|
||||
}));
|
||||
|
||||
vi.mock("./provider-model-normalization.runtime.js", () => ({
|
||||
|
||||
Reference in New Issue
Block a user