@@ -1137,6 +1137,7 @@ describe("cron tool", () => {
11371137
11381138 it . each ( [
11391139 {
1140+ additionalProperty : "enabled " ,
11401141 callId : "call-duplicate-padded-add" ,
11411142 input : {
11421143 action : "add" ,
@@ -1153,8 +1154,13 @@ describe("cron tool", () => {
11531154 } ,
11541155 } ,
11551156 label : "job" ,
1157+ verify : ( params : Record < string , unknown > ) => {
1158+ expect ( params . enabled ) . toBe ( false ) ;
1159+ expect ( params [ "enabled " ] ) . toBe ( true ) ;
1160+ } ,
11561161 } ,
11571162 {
1163+ additionalProperty : "enabled " ,
11581164 callId : "call-flat-duplicate-padded-add" ,
11591165 input : {
11601166 action : "add" ,
@@ -1169,22 +1175,60 @@ describe("cron tool", () => {
11691175 "enabled " : true ,
11701176 } ,
11711177 label : "flat" ,
1178+ verify : ( params : Record < string , unknown > ) => {
1179+ expect ( params . enabled ) . toBe ( false ) ;
1180+ expect ( params [ "enabled " ] ) . toBe ( true ) ;
1181+ } ,
1182+ } ,
1183+ {
1184+ additionalProperty : "cron " ,
1185+ callId : "call-flat-duplicate-padded-cron-add" ,
1186+ input : {
1187+ action : "add" ,
1188+ name : "Holiday Check-in" ,
1189+ cron : "30 10,20 * * *" ,
1190+ "cron " : "*/5 * * * *" ,
1191+ sessionTarget : "isolated" ,
1192+ message : "Holiday check-in: how's everything going?" ,
1193+ } ,
1194+ label : "flat schedule shorthand" ,
1195+ verify : ( params : Record < string , unknown > ) => {
1196+ expect ( params . schedule ) . toMatchObject ( { expr : "30 10,20 * * *" , kind : "cron" } ) ;
1197+ expect ( params [ "cron " ] ) . toBe ( "*/5 * * * *" ) ;
1198+ } ,
1199+ } ,
1200+ {
1201+ additionalProperty : "allowUnsafeExternalContent " ,
1202+ callId : "call-flat-duplicate-padded-payload-add" ,
1203+ input : {
1204+ action : "add" ,
1205+ name : "Holiday Check-in" ,
1206+ schedule : { expr : "30 10,20 * * *" , kind : "cron" , tz : "Europe/Madrid" } ,
1207+ sessionTarget : "isolated" ,
1208+ message : "Holiday check-in: how's everything going?" ,
1209+ allowUnsafeExternalContent : false ,
1210+ "allowUnsafeExternalContent " : true ,
1211+ } ,
1212+ label : "flat payload shorthand" ,
1213+ verify : ( params : Record < string , unknown > ) => {
1214+ expect ( params . payload ) . toMatchObject ( { allowUnsafeExternalContent : false } ) ;
1215+ expect ( params [ "allowUnsafeExternalContent " ] ) . toBe ( true ) ;
1216+ } ,
11721217 } ,
11731218 ] ) (
11741219 "preserves duplicate whitespace-padded cron add $label keys for strict validation" ,
1175- async ( { callId, input } ) => {
1220+ async ( { additionalProperty , callId, input, verify } ) => {
11761221 const tool = createTestCronTool ( ) ;
11771222 await tool . execute ( callId , input ) ;
11781223
11791224 const params = expectSingleGatewayCallMethod ( "cron.add" ) as Record < string , unknown > ;
1180- expect ( params . enabled ) . toBe ( false ) ;
1181- expect ( params [ "enabled " ] ) . toBe ( true ) ;
1225+ verify ( params ) ;
11821226 expect ( Value . Check ( CronAddParamsSchema , params ) ) . toBe ( false ) ;
11831227 expect ( Array . from ( Value . Errors ( CronAddParamsSchema , params ) ) ) . toEqual (
11841228 expect . arrayContaining ( [
11851229 expect . objectContaining ( {
11861230 keyword : "additionalProperties" ,
1187- params : { additionalProperties : [ "enabled " ] } ,
1231+ params : { additionalProperties : [ additionalProperty ] } ,
11881232 } ) ,
11891233 ] ) ,
11901234 ) ;
0 commit comments