First Release of Claw3D (#11)

Co-authored-by: iamlukethedev <iamlukethedev@users.noreply.github.com>
This commit is contained in:
Luke The Dev
2026-03-19 23:14:04 -05:00
committed by GitHub
parent 5ea96b2650
commit 4fa4f13558
431 changed files with 105438 additions and 14 deletions
+72
View File
@@ -0,0 +1,72 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { removeSkillFromGateway } from "@/lib/skills/remove";
describe("skills remove client", () => {
afterEach(() => {
vi.restoreAllMocks();
vi.unstubAllGlobals();
});
it("posts skill removal payload to the Studio API route", async () => {
const fetchMock = vi.fn(async () => ({
ok: true,
text: async () =>
JSON.stringify({
result: {
removed: true,
removedPath: "/tmp/workspace/skills/github",
source: "openclaw-workspace",
},
}),
}));
vi.stubGlobal("fetch", fetchMock);
const result = await removeSkillFromGateway({
skillKey: " github ",
source: "openclaw-workspace",
baseDir: " /tmp/workspace/skills/github ",
workspaceDir: " /tmp/workspace ",
managedSkillsDir: " /tmp/managed ",
});
expect(fetchMock).toHaveBeenCalledWith("/api/gateway/skills/remove", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
skillKey: "github",
source: "openclaw-workspace",
baseDir: "/tmp/workspace/skills/github",
workspaceDir: "/tmp/workspace",
managedSkillsDir: "/tmp/managed",
}),
});
expect(result).toEqual({
removed: true,
removedPath: "/tmp/workspace/skills/github",
source: "openclaw-workspace",
});
});
it("fails fast when required payload fields are missing", async () => {
await expect(
removeSkillFromGateway({
skillKey: " ",
source: "openclaw-workspace",
baseDir: "/tmp/workspace/skills/github",
workspaceDir: "/tmp/workspace",
managedSkillsDir: "/tmp/managed",
})
).rejects.toThrow("skillKey is required.");
await expect(
removeSkillFromGateway({
skillKey: "github",
source: "openclaw-workspace",
baseDir: " ",
workspaceDir: "/tmp/workspace",
managedSkillsDir: "/tmp/managed",
})
).rejects.toThrow("baseDir is required.");
});
});