@@ -98,7 +98,7 @@ describe("nodes-cli coverage", () => {
9898 return ;
9999 }
100100 sharedProgram . exitOverride ( ) ;
101- await registerNodesCli ( sharedProgram ) ;
101+ await registerNodesCli ( sharedProgram , [ "node" , "openclaw" , "nodes" , "status" ] ) ;
102102 } ) ;
103103
104104 beforeEach ( ( ) => {
@@ -292,6 +292,42 @@ describe("nodes-cli coverage", () => {
292292 args : [ "nodes" , "rename" , "--node" , "mac-1" , "--name" , " " ] ,
293293 message : "--name must not be empty" ,
294294 } ,
295+ {
296+ label : "push with an invalid environment" ,
297+ command : "push" ,
298+ args : [ "nodes" , "push" , "--node" , "mac-1" , "--environment" , "staging" ] ,
299+ message : "invalid --environment (use sandbox|production)" ,
300+ } ,
301+ {
302+ label : "notify without a title or body" ,
303+ command : "notify" ,
304+ args : [ "nodes" , "notify" , "--node" , "mac-1" , "--title" , " " , "--body" , " " ] ,
305+ message : "missing --title or --body" ,
306+ } ,
307+ {
308+ label : "camera snap with an invalid facing" ,
309+ command : "camera snap" ,
310+ args : [ "nodes" , "camera" , "snap" , "--node" , "mac-1" , "--facing" , "side" ] ,
311+ message : "invalid facing: side (expected front|back|both)" ,
312+ } ,
313+ {
314+ label : "camera clip with an invalid facing" ,
315+ command : "camera clip" ,
316+ args : [ "nodes" , "camera" , "clip" , "--node" , "mac-1" , "--facing" , "both" ] ,
317+ message : "invalid facing: both (expected front|back)" ,
318+ } ,
319+ {
320+ label : "camera clip with an invalid duration" ,
321+ command : "camera clip" ,
322+ args : [ "nodes" , "camera" , "clip" , "--node" , "mac-1" , "--duration" , "later" ] ,
323+ message : "Invalid duration" ,
324+ } ,
325+ {
326+ label : "screen record with an invalid duration" ,
327+ command : "screen record" ,
328+ args : [ "nodes" , "screen" , "record" , "--node" , "mac-1" , "--duration" , "later" ] ,
329+ message : "Invalid duration" ,
330+ } ,
295331 ] ) ( "reports $label once before calling the gateway" , async ( { command, args, message } ) => {
296332 await expect ( sharedProgram . parseAsync ( args , { from : "user" } ) ) . rejects . toThrow ( "__exit__:1" ) ;
297333
@@ -605,9 +641,13 @@ describe("nodes-cli coverage", () => {
605641 ] ,
606642 flag : "--invoke-timeout" ,
607643 } ,
608- ] ) ( "rejects partial numeric option for $args" , async ( { args, flag } ) => {
609- await expect ( sharedProgram . parseAsync ( args , { from : "user" } ) ) . rejects . toThrow ( "__exit__:1" ) ;
610- expect ( runtimeErrors . at ( - 1 ) ) . toContain ( `${ flag } must be` ) ;
611- expect ( lastNodeInvokeCall ) . toBeNull ( ) ;
612- } ) ;
644+ ] ) (
645+ "rejects invalid numeric option before calling the gateway for $args" ,
646+ async ( { args, flag } ) => {
647+ await expect ( sharedProgram . parseAsync ( args , { from : "user" } ) ) . rejects . toThrow ( "__exit__:1" ) ;
648+ expect ( runtimeErrors . at ( - 1 ) ) . toContain ( `${ flag } must be` ) ;
649+ expect ( callGateway ) . not . toHaveBeenCalled ( ) ;
650+ expect ( lastNodeInvokeCall ) . toBeNull ( ) ;
651+ } ,
652+ ) ;
613653} ) ;
0 commit comments