mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-07 07:58:36 +00:00
test(perf): pin runtime metadata fixtures
This commit is contained in:
@@ -1,12 +1,32 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const normalizeProviderModelIdWithPluginMock = vi.fn();
|
||||
const emptyPluginMetadataSnapshot = vi.hoisted(() => ({
|
||||
configFingerprint: "model-selection-plugin-runtime-test-empty-plugin-metadata",
|
||||
plugins: [
|
||||
{
|
||||
modelIdNormalization: {
|
||||
providers: {
|
||||
google: {
|
||||
aliases: {
|
||||
"gemini-3.1-pro": "gemini-3.1-pro-preview",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}));
|
||||
|
||||
vi.mock("./provider-model-normalization.runtime.js", () => ({
|
||||
normalizeProviderModelIdWithRuntime: (params: unknown) =>
|
||||
normalizeProviderModelIdWithPluginMock(params),
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/current-plugin-metadata-snapshot.js", () => ({
|
||||
getCurrentPluginMetadataSnapshot: () => emptyPluginMetadataSnapshot,
|
||||
}));
|
||||
|
||||
describe("model-selection plugin runtime normalization", () => {
|
||||
beforeEach(() => {
|
||||
vi.resetModules();
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
const emptyPluginMetadataSnapshot = vi.hoisted(() => ({
|
||||
configFingerprint: "models-list-configured-test-empty-plugin-metadata",
|
||||
plugins: [],
|
||||
}));
|
||||
|
||||
vi.mock("../../agents/provider-model-normalization.runtime.js", () => ({
|
||||
normalizeProviderModelIdWithRuntime: vi.fn(() => {
|
||||
throw new Error("runtime model normalization should not load for models list entries");
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("../../plugins/current-plugin-metadata-snapshot.js", () => ({
|
||||
getCurrentPluginMetadataSnapshot: () => emptyPluginMetadataSnapshot,
|
||||
}));
|
||||
|
||||
import { resolveConfiguredEntries } from "./list.configured.js";
|
||||
|
||||
describe("resolveConfiguredEntries", () => {
|
||||
|
||||
@@ -3,12 +3,20 @@ import type { OpenClawConfig } from "../config/config.js";
|
||||
import type { SessionEntry } from "../config/sessions.js";
|
||||
|
||||
const normalizeProviderModelIdWithPluginMock = vi.fn();
|
||||
const emptyPluginMetadataSnapshot = vi.hoisted(() => ({
|
||||
configFingerprint: "gateway-session-utils-plugin-runtime-test-empty-plugin-metadata",
|
||||
plugins: [],
|
||||
}));
|
||||
|
||||
vi.mock("../agents/provider-model-normalization.runtime.js", () => ({
|
||||
normalizeProviderModelIdWithRuntime: (params: unknown) =>
|
||||
normalizeProviderModelIdWithPluginMock(params),
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/current-plugin-metadata-snapshot.js", () => ({
|
||||
getCurrentPluginMetadataSnapshot: () => emptyPluginMetadataSnapshot,
|
||||
}));
|
||||
|
||||
describe("gateway session list plugin runtime normalization", () => {
|
||||
beforeEach(() => {
|
||||
vi.resetModules();
|
||||
|
||||
Reference in New Issue
Block a user