@@ -33,4 +33,65 @@ describe("skills-remote", () => {
3333 removeRemoteNodeInfo ( nodeId ) ;
3434 } ) . not . toThrow ( ) ;
3535 } ) ;
36+
37+ it ( "ignores non-mac and non-system.run nodes for eligibility" , ( ) => {
38+ const linuxNodeId = `node-${ randomUUID ( ) } ` ;
39+ const noRunNodeId = `node-${ randomUUID ( ) } ` ;
40+ const bin = `bin-${ randomUUID ( ) } ` ;
41+ try {
42+ recordRemoteNodeInfo ( {
43+ nodeId : linuxNodeId ,
44+ displayName : "Linux Box" ,
45+ platform : "linux" ,
46+ commands : [ "system.run" ] ,
47+ } ) ;
48+ recordRemoteNodeBins ( linuxNodeId , [ bin ] ) ;
49+
50+ recordRemoteNodeInfo ( {
51+ nodeId : noRunNodeId ,
52+ displayName : "Remote Mac" ,
53+ platform : "darwin" ,
54+ commands : [ "system.which" ] ,
55+ } ) ;
56+ recordRemoteNodeBins ( noRunNodeId , [ bin ] ) ;
57+
58+ expect ( getRemoteSkillEligibility ( ) ) . toBeUndefined ( ) ;
59+ } finally {
60+ removeRemoteNodeInfo ( linuxNodeId ) ;
61+ removeRemoteNodeInfo ( noRunNodeId ) ;
62+ }
63+ } ) ;
64+
65+ it ( "aggregates bins and note labels across eligible mac nodes" , ( ) => {
66+ const nodeA = `node-${ randomUUID ( ) } ` ;
67+ const nodeB = `node-${ randomUUID ( ) } ` ;
68+ const binA = `bin-${ randomUUID ( ) } ` ;
69+ const binB = `bin-${ randomUUID ( ) } ` ;
70+ try {
71+ recordRemoteNodeInfo ( {
72+ nodeId : nodeA ,
73+ displayName : "Mac Studio" ,
74+ platform : "darwin" ,
75+ commands : [ "system.run" ] ,
76+ } ) ;
77+ recordRemoteNodeBins ( nodeA , [ binA ] ) ;
78+
79+ recordRemoteNodeInfo ( {
80+ nodeId : nodeB ,
81+ platform : "macOS" ,
82+ commands : [ "system.run" ] ,
83+ } ) ;
84+ recordRemoteNodeBins ( nodeB , [ binB ] ) ;
85+
86+ const eligibility = getRemoteSkillEligibility ( ) ;
87+ expect ( eligibility ?. platforms ) . toEqual ( [ "darwin" ] ) ;
88+ expect ( eligibility ?. hasBin ( binA ) ) . toBe ( true ) ;
89+ expect ( eligibility ?. hasAnyBin ( [ `missing-${ randomUUID ( ) } ` , binB ] ) ) . toBe ( true ) ;
90+ expect ( eligibility ?. note ) . toContain ( "Mac Studio" ) ;
91+ expect ( eligibility ?. note ) . toContain ( nodeB ) ;
92+ } finally {
93+ removeRemoteNodeInfo ( nodeA ) ;
94+ removeRemoteNodeInfo ( nodeB ) ;
95+ }
96+ } ) ;
3697} ) ;
0 commit comments