Skip to content

Commit 167e433

Browse files
committed
test(perf): pin runtime metadata fixtures
1 parent 17a7bc7 commit 167e433

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

src/agents/model-selection.plugin-runtime.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
11
import { beforeEach, describe, expect, it, vi } from "vitest";
22

33
const normalizeProviderModelIdWithPluginMock = vi.fn();
4+
const emptyPluginMetadataSnapshot = vi.hoisted(() => ({
5+
configFingerprint: "model-selection-plugin-runtime-test-empty-plugin-metadata",
6+
plugins: [
7+
{
8+
modelIdNormalization: {
9+
providers: {
10+
google: {
11+
aliases: {
12+
"gemini-3.1-pro": "gemini-3.1-pro-preview",
13+
},
14+
},
15+
},
16+
},
17+
},
18+
],
19+
}));
420

521
vi.mock("./provider-model-normalization.runtime.js", () => ({
622
normalizeProviderModelIdWithRuntime: (params: unknown) =>
723
normalizeProviderModelIdWithPluginMock(params),
824
}));
925

26+
vi.mock("../plugins/current-plugin-metadata-snapshot.js", () => ({
27+
getCurrentPluginMetadataSnapshot: () => emptyPluginMetadataSnapshot,
28+
}));
29+
1030
describe("model-selection plugin runtime normalization", () => {
1131
beforeEach(() => {
1232
vi.resetModules();

src/commands/models/list.configured.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
import { describe, expect, it, vi } from "vitest";
22

3+
const emptyPluginMetadataSnapshot = vi.hoisted(() => ({
4+
configFingerprint: "models-list-configured-test-empty-plugin-metadata",
5+
plugins: [],
6+
}));
7+
38
vi.mock("../../agents/provider-model-normalization.runtime.js", () => ({
49
normalizeProviderModelIdWithRuntime: vi.fn(() => {
510
throw new Error("runtime model normalization should not load for models list entries");
611
}),
712
}));
813

14+
vi.mock("../../plugins/current-plugin-metadata-snapshot.js", () => ({
15+
getCurrentPluginMetadataSnapshot: () => emptyPluginMetadataSnapshot,
16+
}));
17+
918
import { resolveConfiguredEntries } from "./list.configured.js";
1019

1120
describe("resolveConfiguredEntries", () => {

src/gateway/session-utils.plugin-runtime.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,20 @@ import type { OpenClawConfig } from "../config/config.js";
33
import type { SessionEntry } from "../config/sessions.js";
44

55
const normalizeProviderModelIdWithPluginMock = vi.fn();
6+
const emptyPluginMetadataSnapshot = vi.hoisted(() => ({
7+
configFingerprint: "gateway-session-utils-plugin-runtime-test-empty-plugin-metadata",
8+
plugins: [],
9+
}));
610

711
vi.mock("../agents/provider-model-normalization.runtime.js", () => ({
812
normalizeProviderModelIdWithRuntime: (params: unknown) =>
913
normalizeProviderModelIdWithPluginMock(params),
1014
}));
1115

16+
vi.mock("../plugins/current-plugin-metadata-snapshot.js", () => ({
17+
getCurrentPluginMetadataSnapshot: () => emptyPluginMetadataSnapshot,
18+
}));
19+
1220
describe("gateway session list plugin runtime normalization", () => {
1321
beforeEach(() => {
1422
vi.resetModules();

0 commit comments

Comments
 (0)