test(commands): trim duplicate legacy migration cases

This commit is contained in:
Vincent Koc
2026-04-12 10:34:14 +01:00
parent a09e228e3e
commit 80bff30612

View File

@@ -110,38 +110,6 @@ describe("normalizeCompatibilityConfigValues", () => {
]);
});
it("migrates legacy x_search auth into xai plugin-owned config", () => {
const res = normalizeCompatibilityConfigValues({
tools: {
web: {
x_search: {
apiKey: "xai-legacy-key",
enabled: true,
model: "grok-4-1-fast",
},
} as Record<string, unknown>,
},
});
expect((res.config.tools?.web as Record<string, unknown> | undefined)?.x_search).toEqual({
enabled: true,
model: "grok-4-1-fast",
});
expect(res.config.plugins?.entries?.xai).toEqual({
enabled: true,
config: {
webSearch: {
apiKey: "xai-legacy-key",
},
},
});
expect(res.changes).toEqual(
expect.arrayContaining([
"Moved tools.web.x_search.apiKey → plugins.entries.xai.config.webSearch.apiKey.",
]),
);
});
it("migrates Discord account dm.policy/dm.allowFrom to dmPolicy/allowFrom aliases", () => {
const res = normalizeCompatibilityConfigValues({
channels: {
@@ -565,42 +533,6 @@ describe("normalizeCompatibilityConfigValues", () => {
]);
});
it("migrates legacy web fetch provider config to plugin-owned config paths", () => {
const res = normalizeCompatibilityConfigValues({
tools: {
web: {
fetch: {
provider: "firecrawl",
timeoutSeconds: 15,
firecrawl: {
apiKey: "firecrawl-key",
baseUrl: "https://api.firecrawl.dev",
onlyMainContent: false,
},
},
},
},
} as OpenClawConfig);
expect(res.config.tools?.web?.fetch).toEqual({
provider: "firecrawl",
timeoutSeconds: 15,
});
expect(res.config.plugins?.entries?.firecrawl).toEqual({
enabled: true,
config: {
webFetch: {
apiKey: "firecrawl-key",
baseUrl: "https://api.firecrawl.dev",
onlyMainContent: false,
},
},
});
expect(res.changes).toEqual([
"Moved tools.web.fetch.firecrawl → plugins.entries.firecrawl.config.webFetch.",
]);
});
it("keeps explicit plugin-owned web fetch config while filling missing legacy fields", () => {
const res = normalizeCompatibilityConfigValues({
tools: {