Files
openclaw/src/agents/openclaw-tools.browser-plugin.integration.test.ts
2026-03-26 22:20:40 +00:00

52 lines
1.4 KiB
TypeScript

import { afterEach, beforeEach, describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
import { clearPluginLoaderCache } from "../plugins/loader.js";
import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js";
import { resetPluginRuntimeStateForTest } from "../plugins/runtime.js";
import { createOpenClawTools } from "./openclaw-tools.js";
function resetPluginState() {
clearPluginLoaderCache();
clearPluginManifestRegistryCache();
resetPluginRuntimeStateForTest();
}
describe("createOpenClawTools browser plugin integration", () => {
beforeEach(() => {
resetPluginState();
});
afterEach(() => {
resetPluginState();
});
it("loads the bundled browser plugin through normal plugin resolution", () => {
const tools = createOpenClawTools({
config: {
plugins: {
allow: ["browser"],
},
} as OpenClawConfig,
});
expect(tools.map((tool) => tool.name)).toContain("browser");
});
it("omits the browser tool when the bundled browser plugin is disabled", () => {
const tools = createOpenClawTools({
config: {
plugins: {
allow: ["browser"],
entries: {
browser: {
enabled: false,
},
},
},
} as OpenClawConfig,
});
expect(tools.map((tool) => tool.name)).not.toContain("browser");
});
});