Files
horus-3d/tests/unit/skillsRemoveExecutor.test.ts
T
Luke The Dev 4fa4f13558 First Release of Claw3D (#11)
Co-authored-by: iamlukethedev <iamlukethedev@users.noreply.github.com>
2026-03-19 23:14:04 -05:00

59 lines
1.6 KiB
TypeScript

import { beforeEach, describe, expect, it, vi } from "vitest";
import { runSshJson } from "@/lib/ssh/gateway-host";
import { removeSkillOverSsh } from "@/lib/ssh/skills-remove";
vi.mock("@/lib/ssh/gateway-host", () => ({
runSshJson: vi.fn(),
}));
describe("skills remove ssh executor", () => {
const mockedRunSshJson = vi.mocked(runSshJson);
beforeEach(() => {
mockedRunSshJson.mockReset();
});
it("removes skill files via ssh", () => {
mockedRunSshJson.mockReturnValueOnce({
removed: true,
removedPath: "/home/ubuntu/.openclaw/skills/github",
source: "openclaw-managed",
});
const result = removeSkillOverSsh({
sshTarget: "me@host",
request: {
skillKey: "github",
source: "openclaw-managed",
baseDir: "/home/ubuntu/.openclaw/skills/github",
workspaceDir: "/home/ubuntu/.openclaw/workspace-main",
managedSkillsDir: "/home/ubuntu/.openclaw/skills",
},
});
expect(result).toEqual({
removed: true,
removedPath: "/home/ubuntu/.openclaw/skills/github",
source: "openclaw-managed",
});
expect(runSshJson).toHaveBeenCalledWith(
expect.objectContaining({
sshTarget: "me@host",
argv: [
"bash",
"-s",
"--",
"github",
"openclaw-managed",
"/home/ubuntu/.openclaw/skills/github",
"/home/ubuntu/.openclaw/workspace-main",
"/home/ubuntu/.openclaw/skills",
],
label: "remove skill (github)",
input: expect.stringContaining('python3 - "$1" "$2" "$3" "$4" "$5"'),
})
);
});
});