mirror of https://github.com/openclaw/openclaw.git
test: expand remote skill eligibility coverage
This commit is contained in:
parent
6cb8729952
commit
a6b4294bfd
|
|
@ -33,4 +33,65 @@ describe("skills-remote", () => {
|
|||
removeRemoteNodeInfo(nodeId);
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("ignores non-mac and non-system.run nodes for eligibility", () => {
|
||||
const linuxNodeId = `node-${randomUUID()}`;
|
||||
const noRunNodeId = `node-${randomUUID()}`;
|
||||
const bin = `bin-${randomUUID()}`;
|
||||
try {
|
||||
recordRemoteNodeInfo({
|
||||
nodeId: linuxNodeId,
|
||||
displayName: "Linux Box",
|
||||
platform: "linux",
|
||||
commands: ["system.run"],
|
||||
});
|
||||
recordRemoteNodeBins(linuxNodeId, [bin]);
|
||||
|
||||
recordRemoteNodeInfo({
|
||||
nodeId: noRunNodeId,
|
||||
displayName: "Remote Mac",
|
||||
platform: "darwin",
|
||||
commands: ["system.which"],
|
||||
});
|
||||
recordRemoteNodeBins(noRunNodeId, [bin]);
|
||||
|
||||
expect(getRemoteSkillEligibility()).toBeUndefined();
|
||||
} finally {
|
||||
removeRemoteNodeInfo(linuxNodeId);
|
||||
removeRemoteNodeInfo(noRunNodeId);
|
||||
}
|
||||
});
|
||||
|
||||
it("aggregates bins and note labels across eligible mac nodes", () => {
|
||||
const nodeA = `node-${randomUUID()}`;
|
||||
const nodeB = `node-${randomUUID()}`;
|
||||
const binA = `bin-${randomUUID()}`;
|
||||
const binB = `bin-${randomUUID()}`;
|
||||
try {
|
||||
recordRemoteNodeInfo({
|
||||
nodeId: nodeA,
|
||||
displayName: "Mac Studio",
|
||||
platform: "darwin",
|
||||
commands: ["system.run"],
|
||||
});
|
||||
recordRemoteNodeBins(nodeA, [binA]);
|
||||
|
||||
recordRemoteNodeInfo({
|
||||
nodeId: nodeB,
|
||||
platform: "macOS",
|
||||
commands: ["system.run"],
|
||||
});
|
||||
recordRemoteNodeBins(nodeB, [binB]);
|
||||
|
||||
const eligibility = getRemoteSkillEligibility();
|
||||
expect(eligibility?.platforms).toEqual(["darwin"]);
|
||||
expect(eligibility?.hasBin(binA)).toBe(true);
|
||||
expect(eligibility?.hasAnyBin([`missing-${randomUUID()}`, binB])).toBe(true);
|
||||
expect(eligibility?.note).toContain("Mac Studio");
|
||||
expect(eligibility?.note).toContain(nodeB);
|
||||
} finally {
|
||||
removeRemoteNodeInfo(nodeA);
|
||||
removeRemoteNodeInfo(nodeB);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue