@@ -698,61 +698,16 @@ describe("cron edit command", () => {
698698 ) ;
699699 } ) ;
700700
701- it . each ( [ "" , " " ] ) ( "omits blank --model %j from the update patch" , async ( model ) => {
702- await createCronProgram ( ) . parseAsync (
703- [ "edit" , "job-1" , "--message" , "hello" , "--model" , model ] ,
704- {
705- from : "user" ,
706- } ,
701+ it . each ( [
702+ [ "--model" , "" , "--clear-model" ] ,
703+ [ "--model" , " " , "--clear-model" ] ,
704+ [ "--thinking" , "" , "--clear-thinking" ] ,
705+ [ "--thinking" , " " , "--clear-thinking" ] ,
706+ ] ) ( "rejects blank %s %j combined with %s" , async ( flag , value , clearFlag ) => {
707+ await expectCronEditRejection (
708+ [ flag , value , clearFlag ] ,
709+ `Use ${ flag } or ${ clearFlag } , not both` ,
707710 ) ;
708-
709- expect ( callGatewayFromCli ) . toHaveBeenCalledWith ( "cron.update" , expect . anything ( ) , {
710- id : "job-1" ,
711- patch : {
712- payload : {
713- kind : "agentTurn" ,
714- message : "hello" ,
715- } ,
716- } ,
717- } ) ;
718- } ) ;
719-
720- it . each ( [ "" , " " ] ) ( "rejects blank --model %j combined with --clear-model" , async ( model ) => {
721- const errorSpy = vi . spyOn ( defaultRuntime , "error" ) . mockImplementation ( ( ) => { } ) ;
722- const exitSpy = vi . spyOn ( defaultRuntime , "exit" ) . mockImplementation ( ( ( ) => undefined ) as never ) ;
723-
724- try {
725- await createCronProgram ( ) . parseAsync ( [ "edit" , "job-1" , "--model" , model , "--clear-model" ] , {
726- from : "user" ,
727- } ) ;
728-
729- expect ( errorSpy ) . toHaveBeenCalledWith (
730- expect . stringContaining ( "Use --model or --clear-model, not both" ) ,
731- ) ;
732- expect ( callGatewayFromCli ) . not . toHaveBeenCalled ( ) ;
733- } finally {
734- errorSpy . mockRestore ( ) ;
735- exitSpy . mockRestore ( ) ;
736- }
737- } ) ;
738-
739- it ( "rejects --model combined with --clear-model" , async ( ) => {
740- const errorSpy = vi . spyOn ( defaultRuntime , "error" ) . mockImplementation ( ( ) => { } ) ;
741- const exitSpy = vi . spyOn ( defaultRuntime , "exit" ) . mockImplementation ( ( ( ) => undefined ) as never ) ;
742-
743- try {
744- await createCronProgram ( ) . parseAsync ( [ "edit" , "job-1" , "--model" , "opus" , "--clear-model" ] , {
745- from : "user" ,
746- } ) ;
747-
748- expect ( errorSpy ) . toHaveBeenCalledWith (
749- expect . stringContaining ( "Use --model or --clear-model, not both" ) ,
750- ) ;
751- expect ( callGatewayFromCli ) . not . toHaveBeenCalled ( ) ;
752- } finally {
753- errorSpy . mockRestore ( ) ;
754- exitSpy . mockRestore ( ) ;
755- }
756711 } ) ;
757712
758713 it ( "stores an explicit wildcard with --clear-tools" , async ( ) => {
@@ -988,48 +943,6 @@ describe("cron edit command", () => {
988943 exitSpy . mockRestore ( ) ;
989944 } ) ;
990945
991- it . each ( [ "" , " " ] ) ( "omits blank --thinking %j from the update patch" , async ( thinking ) => {
992- await createCronProgram ( ) . parseAsync (
993- [ "edit" , "job-1" , "--message" , "hello" , "--thinking" , thinking ] ,
994- { from : "user" } ,
995- ) ;
996-
997- expect ( callGatewayFromCli ) . toHaveBeenCalledWith ( "cron.update" , expect . anything ( ) , {
998- id : "job-1" ,
999- patch : {
1000- payload : {
1001- kind : "agentTurn" ,
1002- message : "hello" ,
1003- } ,
1004- } ,
1005- } ) ;
1006- } ) ;
1007-
1008- it . each ( [ "" , " " ] ) (
1009- "rejects blank --thinking %j combined with --clear-thinking" ,
1010- async ( thinking ) => {
1011- const errorSpy = vi . spyOn ( defaultRuntime , "error" ) . mockImplementation ( ( ) => { } ) ;
1012- const exitSpy = vi
1013- . spyOn ( defaultRuntime , "exit" )
1014- . mockImplementation ( ( ( ) => undefined ) as never ) ;
1015-
1016- try {
1017- await createCronProgram ( ) . parseAsync (
1018- [ "edit" , "job-1" , "--thinking" , thinking , "--clear-thinking" ] ,
1019- { from : "user" } ,
1020- ) ;
1021-
1022- expect ( errorSpy ) . toHaveBeenCalledWith (
1023- expect . stringContaining ( "Use --thinking or --clear-thinking, not both" ) ,
1024- ) ;
1025- expect ( callGatewayFromCli ) . not . toHaveBeenCalled ( ) ;
1026- } finally {
1027- errorSpy . mockRestore ( ) ;
1028- exitSpy . mockRestore ( ) ;
1029- }
1030- } ,
1031- ) ;
1032-
1033946 it ( "documents the --clear-model flag alongside the sibling --clear-tools" , ( ) => {
1034947 const editCommand = createCronProgram ( ) . commands . find ( ( command ) => command . name ( ) === "edit" ) ;
1035948 const help = editCommand ?. helpInformation ( ) ?? "" ;
0 commit comments