mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:30:43 +00:00
test(agents): share bundle mcp runtime fixture
This commit is contained in:
@@ -19,24 +19,29 @@ afterEach(async () => {
|
||||
await cleanupBundleMcpHarness();
|
||||
});
|
||||
|
||||
describe("createBundleMcpToolRuntime", () => {
|
||||
it("loads bundle MCP tools and executes them", async () => {
|
||||
const workspaceDir = await makeTempDir("openclaw-bundle-mcp-tools-");
|
||||
const pluginRoot = path.join(workspaceDir, ".openclaw", "extensions", "bundle-probe");
|
||||
const serverScriptPath = path.join(pluginRoot, "servers", "bundle-probe.mjs");
|
||||
await writeBundleProbeMcpServer(serverScriptPath);
|
||||
await writeClaudeBundle({ pluginRoot, serverScriptPath });
|
||||
async function createBundleProbeRuntime(params?: { reservedToolNames?: string[] }) {
|
||||
const workspaceDir = await makeTempDir("openclaw-bundle-mcp-tools-");
|
||||
const pluginRoot = path.join(workspaceDir, ".openclaw", "extensions", "bundle-probe");
|
||||
const serverScriptPath = path.join(pluginRoot, "servers", "bundle-probe.mjs");
|
||||
await writeBundleProbeMcpServer(serverScriptPath);
|
||||
await writeClaudeBundle({ pluginRoot, serverScriptPath });
|
||||
|
||||
const runtime = await createBundleMcpToolRuntime({
|
||||
workspaceDir,
|
||||
cfg: {
|
||||
plugins: {
|
||||
entries: {
|
||||
"bundle-probe": { enabled: true },
|
||||
},
|
||||
return await createBundleMcpToolRuntime({
|
||||
workspaceDir,
|
||||
cfg: {
|
||||
plugins: {
|
||||
entries: {
|
||||
"bundle-probe": { enabled: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
reservedToolNames: params?.reservedToolNames,
|
||||
});
|
||||
}
|
||||
|
||||
describe("createBundleMcpToolRuntime", () => {
|
||||
it("loads bundle MCP tools and executes them", async () => {
|
||||
const runtime = await createBundleProbeRuntime();
|
||||
|
||||
try {
|
||||
expect(runtime.tools.map((tool) => tool.name)).toEqual(["bundleProbe__bundle_probe"]);
|
||||
@@ -55,21 +60,7 @@ describe("createBundleMcpToolRuntime", () => {
|
||||
});
|
||||
|
||||
it("disambiguates bundle MCP tools that collide with existing tool names", async () => {
|
||||
const workspaceDir = await makeTempDir("openclaw-bundle-mcp-tools-");
|
||||
const pluginRoot = path.join(workspaceDir, ".openclaw", "extensions", "bundle-probe");
|
||||
const serverScriptPath = path.join(pluginRoot, "servers", "bundle-probe.mjs");
|
||||
await writeBundleProbeMcpServer(serverScriptPath);
|
||||
await writeClaudeBundle({ pluginRoot, serverScriptPath });
|
||||
|
||||
const runtime = await createBundleMcpToolRuntime({
|
||||
workspaceDir,
|
||||
cfg: {
|
||||
plugins: {
|
||||
entries: {
|
||||
"bundle-probe": { enabled: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
const runtime = await createBundleProbeRuntime({
|
||||
reservedToolNames: ["bundleProbe__bundle_probe"],
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user