mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 14:10:24 +00:00
37 lines
1005 B
TypeScript
37 lines
1005 B
TypeScript
import { randomUUID } from "node:crypto";
|
|
import { describe, expect, it } from "vitest";
|
|
import {
|
|
getRemoteSkillEligibility,
|
|
recordRemoteNodeBins,
|
|
recordRemoteNodeInfo,
|
|
removeRemoteNodeInfo,
|
|
} from "./skills-remote.js";
|
|
|
|
describe("skills-remote", () => {
|
|
it("removes disconnected nodes from remote skill eligibility", () => {
|
|
const nodeId = `node-${randomUUID()}`;
|
|
const bin = `bin-${randomUUID()}`;
|
|
recordRemoteNodeInfo({
|
|
nodeId,
|
|
displayName: "Remote Mac",
|
|
platform: "darwin",
|
|
commands: ["system.run"],
|
|
});
|
|
recordRemoteNodeBins(nodeId, [bin]);
|
|
|
|
expect(getRemoteSkillEligibility()?.hasBin(bin)).toBe(true);
|
|
|
|
removeRemoteNodeInfo(nodeId);
|
|
|
|
expect(getRemoteSkillEligibility()?.hasBin(bin) ?? false).toBe(false);
|
|
});
|
|
|
|
it("supports idempotent remote node removal", () => {
|
|
const nodeId = `node-${randomUUID()}`;
|
|
expect(() => {
|
|
removeRemoteNodeInfo(nodeId);
|
|
removeRemoteNodeInfo(nodeId);
|
|
}).not.toThrow();
|
|
});
|
|
});
|