mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-18 13:30:48 +00:00
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { resolveOpenShellPluginConfig } from "./config.js";
|
|
|
|
describe("openshell plugin config", () => {
|
|
it("applies defaults", () => {
|
|
expect(resolveOpenShellPluginConfig(undefined)).toEqual({
|
|
mode: "mirror",
|
|
command: "openshell",
|
|
gateway: undefined,
|
|
gatewayEndpoint: undefined,
|
|
from: "openclaw",
|
|
policy: undefined,
|
|
providers: [],
|
|
gpu: false,
|
|
autoProviders: true,
|
|
remoteWorkspaceDir: "/sandbox",
|
|
remoteAgentWorkspaceDir: "/agent",
|
|
timeoutMs: 120_000,
|
|
});
|
|
});
|
|
|
|
it("accepts remote mode", () => {
|
|
expect(resolveOpenShellPluginConfig({ mode: "remote" }).mode).toBe("remote");
|
|
});
|
|
|
|
it("rejects relative remote paths", () => {
|
|
expect(() =>
|
|
resolveOpenShellPluginConfig({
|
|
remoteWorkspaceDir: "sandbox",
|
|
}),
|
|
).toThrow("OpenShell remote path must be absolute");
|
|
});
|
|
|
|
it("rejects unknown mode", () => {
|
|
expect(() =>
|
|
resolveOpenShellPluginConfig({
|
|
mode: "bogus",
|
|
}),
|
|
).toThrow("mode must be one of mirror, remote");
|
|
});
|
|
});
|