mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:10:44 +00:00
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
import type { OpenClawConfig } from "../config/types.js";
|
|
import { __testing as setupRegistryRuntimeTesting } from "../plugins/setup-registry.runtime.js";
|
|
import { isCliProvider } from "./model-selection-cli.js";
|
|
|
|
describe("isCliProvider", () => {
|
|
beforeEach(() => {
|
|
setupRegistryRuntimeTesting.resetRuntimeState();
|
|
setupRegistryRuntimeTesting.setRuntimeModuleForTest({
|
|
resolvePluginSetupCliBackend: ({ backend }) =>
|
|
backend === "claude-cli"
|
|
? {
|
|
pluginId: "anthropic",
|
|
backend: { id: "claude-cli", config: { command: "claude" } },
|
|
}
|
|
: undefined,
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
setupRegistryRuntimeTesting.resetRuntimeState();
|
|
});
|
|
|
|
it("returns true for setup-registered cli backends", () => {
|
|
expect(isCliProvider("claude-cli", {} as OpenClawConfig)).toBe(true);
|
|
});
|
|
|
|
it("returns false for provider ids", () => {
|
|
expect(isCliProvider("example-cli", {} as OpenClawConfig)).toBe(false);
|
|
});
|
|
});
|