Files
openclaw-zero-token/config/legacy-web-search.test.ts
sjhu 571e14a236 feat: upgrade to upstream v2026.3.28
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
2026-03-30 17:58:12 +08:00

91 lines
2.3 KiB
TypeScript

import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "./config.js";
import {
listLegacyWebSearchConfigPaths,
migrateLegacyWebSearchConfig,
} from "./legacy-web-search.js";
describe("legacy web search config", () => {
it("migrates legacy provider config through bundled web search ownership metadata", () => {
const res = migrateLegacyWebSearchConfig<OpenClawConfig>({
tools: {
web: {
search: {
provider: "grok",
apiKey: "brave-key",
grok: {
apiKey: "xai-key",
model: "grok-4-search",
},
kimi: {
apiKey: "kimi-key",
model: "kimi-k2.5",
},
},
},
},
});
expect(res.config.tools?.web?.search).toEqual({
provider: "grok",
});
expect(res.config.plugins?.entries?.brave).toEqual({
enabled: true,
config: {
webSearch: {
apiKey: "brave-key",
},
},
});
expect(res.config.plugins?.entries?.xai).toEqual({
enabled: true,
config: {
webSearch: {
apiKey: "xai-key",
model: "grok-4-search",
},
},
});
expect(res.config.plugins?.entries?.moonshot).toEqual({
enabled: true,
config: {
webSearch: {
apiKey: "kimi-key",
model: "kimi-k2.5",
},
},
});
expect(res.changes).toEqual([
"Moved tools.web.search.apiKey → plugins.entries.brave.config.webSearch.apiKey.",
"Moved tools.web.search.grok → plugins.entries.xai.config.webSearch.",
"Moved tools.web.search.kimi → plugins.entries.moonshot.config.webSearch.",
]);
});
it("lists legacy paths for metadata-owned provider config", () => {
expect(
listLegacyWebSearchConfigPaths({
tools: {
web: {
search: {
apiKey: "brave-key",
grok: {
apiKey: "xai-key",
model: "grok-4-search",
},
kimi: {
model: "kimi-k2.5",
},
},
},
},
}),
).toEqual([
"tools.web.search.apiKey",
"tools.web.search.grok.apiKey",
"tools.web.search.grok.model",
"tools.web.search.kimi.model",
]);
});
});