@@ -1486,8 +1486,8 @@ describe("cron controller", () => {
14861486 expect ( errors . deliveryTo ) . toBe ( "cron.errors.webhookUrlInvalid" ) ;
14871487 } ) ;
14881488
1489- it . each ( [ "0x10" , "1e3" , "+1" ] ) (
1490- "rejects nondecimal recurring amounts before submit: %s" ,
1489+ it . each ( [ "0x10" , "1e3" , "+1" , String ( Number . MAX_SAFE_INTEGER ) , "0.000001" ] ) (
1490+ "rejects invalid recurring amounts before submit: %s" ,
14911491 async ( everyAmount ) => {
14921492 const request = vi . fn ( async ( method : string ) => {
14931493 if ( method === "cron.add" ) {
@@ -1520,6 +1520,51 @@ describe("cron controller", () => {
15201520 } ,
15211521 ) ;
15221522
1523+ it . each ( [
1524+ [ "1.5" , "minutes" , 90_000 ] ,
1525+ [ "4.1" , "minutes" , 246_000 ] ,
1526+ [ "0.1" , "hours" , 360_000 ] ,
1527+ [ "0.000125" , "hours" , 450 ] ,
1528+ [ "0.1" , "days" , 8_640_000 ] ,
1529+ [ "0.0009765625" , "days" , 84_375 ] ,
1530+ ] as const ) (
1531+ "converts %s %s to safe integer milliseconds" ,
1532+ async ( everyAmount , everyUnit , expectedEveryMs ) => {
1533+ const request = vi . fn ( async ( method : string ) => {
1534+ if ( method === "cron.add" ) {
1535+ return { id : "job-decimal" } ;
1536+ }
1537+ if ( method === "cron.list" ) {
1538+ return { jobs : [ ] } ;
1539+ }
1540+ if ( method === "cron.status" ) {
1541+ return { enabled : true , jobs : 0 , nextWakeAtMs : null } ;
1542+ }
1543+ return { } ;
1544+ } ) ;
1545+ const state = createState ( {
1546+ client : { request } as unknown as CronState [ "client" ] ,
1547+ cronForm : {
1548+ ...DEFAULT_CRON_FORM ,
1549+ name : "decimal interval" ,
1550+ everyAmount,
1551+ everyUnit,
1552+ payloadText : "run" ,
1553+ deliveryMode : "none" ,
1554+ } ,
1555+ } ) ;
1556+
1557+ const saved = await addCronJob ( state ) ;
1558+
1559+ expect ( saved . saved ) . toBe ( true ) ;
1560+ const addCall = findRequestCall ( request . mock . calls , "cron.add" ) ;
1561+ expect ( requestPayload ( addCall ) . schedule ) . toEqual ( {
1562+ kind : "every" ,
1563+ everyMs : expectedEveryMs ,
1564+ } ) ;
1565+ } ,
1566+ ) ;
1567+
15231568 it ( "does not require cron expression fields for on-exit schedules" , ( ) => {
15241569 const errors = validateCronForm ( {
15251570 ...DEFAULT_CRON_FORM ,
0 commit comments