perf: avoid broad testing barrel in moonshot test

This commit is contained in:
Peter Steinberger
2026-04-23 21:43:55 +01:00
parent d9aacbd3f9
commit 59cffb43f7

View File

@@ -1,10 +1,28 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/provider-onboard";
import { withEnv } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { __testing } from "../test-api.js";
const kimiApiKeyEnv = ["KIMI_API", "KEY"].join("_");
function withEnv(overrides: Record<string, string>, run: () => void): void {
const previous = new Map<string, string | undefined>();
for (const [key, value] of Object.entries(overrides)) {
previous.set(key, process.env[key]);
process.env[key] = value;
}
try {
run();
} finally {
for (const [key, value] of previous) {
if (value === undefined) {
delete process.env[key];
} else {
process.env[key] = value;
}
}
}
}
describe("kimi web search provider", () => {
it("uses configured model and base url overrides with sane defaults", () => {
expect(__testing.resolveKimiModel()).toBe("kimi-k2.6");