@@ -36,12 +36,12 @@ describe('onCronTick — hookFamily filter', () => {
3636 const warn = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } )
3737 const ctx = makeCtx ( { } ) // no credentials, no DB
3838
39- await onCronTick ( ctx , {
39+ await onCronTick ( {
4040 type : 'cron:tick' ,
4141 schedule : '*/5 * * * *' ,
4242 hookFamily : 'some-other-plugin-cron' ,
4343 triggeredAt : 1700000000000 ,
44- } )
44+ } , ctx )
4545
4646 expect ( warn ) . not . toHaveBeenCalled ( )
4747 } )
@@ -52,12 +52,12 @@ describe('onCronTick — credential check', () => {
5252 const warn = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } )
5353 const ctx = makeCtx ( { DB : { } , EMAIL_API_TOKEN : 'tok' } )
5454
55- await onCronTick ( ctx , {
55+ await onCronTick ( {
5656 type : 'cron:tick' ,
5757 schedule : '*/5 * * * *' ,
5858 hookFamily : 'email-reconciliation' ,
5959 triggeredAt : 0 ,
60- } )
60+ } , ctx )
6161
6262 expect ( warn ) . toHaveBeenCalledWith (
6363 expect . stringContaining ( 'CF GraphQL credentials missing' ) ,
@@ -69,12 +69,12 @@ describe('onCronTick — credential check', () => {
6969 const warn = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } )
7070 const ctx = makeCtx ( { DB : { } , CF_ZONE_ID : 'zone' } )
7171
72- await onCronTick ( ctx , {
72+ await onCronTick ( {
7373 type : 'cron:tick' ,
7474 schedule : '*/5 * * * *' ,
7575 hookFamily : 'email-reconciliation' ,
7676 triggeredAt : 0 ,
77- } )
77+ } , ctx )
7878
7979 expect ( warn ) . toHaveBeenCalledWith (
8080 expect . stringContaining ( 'CF GraphQL credentials missing' ) ,
@@ -87,12 +87,12 @@ describe('onCronTick — credential check', () => {
8787 const ctx = makeCtx ( { DB : { } } )
8888
8989 await expect (
90- onCronTick ( ctx , {
90+ onCronTick ( {
9191 type : 'cron:tick' ,
9292 schedule : '*/5 * * * *' ,
9393 hookFamily : 'email-reconciliation' ,
9494 triggeredAt : 0 ,
95- } ) ,
95+ } , ctx ) ,
9696 ) . resolves . toBeUndefined ( )
9797 } )
9898} )
@@ -120,7 +120,7 @@ describe('onCronTick — happy path (credentials present)', () => {
120120 ) as never
121121
122122 const ctx = makeCtx ( { DB : { } as unknown , CF_ZONE_ID : 'zone' , EMAIL_API_TOKEN : 'tok' } )
123- await onCronTick ( ctx , { type : 'cron:tick' , schedule : '*/5 * * * *' , hookFamily : 'email-reconciliation' , triggeredAt : 1700000000000 } )
123+ await onCronTick ( { type : 'cron:tick' , schedule : '*/5 * * * *' , hookFamily : 'email-reconciliation' , triggeredAt : 1700000000000 } , ctx )
124124
125125 // Pre-#701: this outcome was silently swallowed — making "cron working but
126126 // CF returned 0 rows" indistinguishable from "cron never fired" in worker logs.
@@ -147,7 +147,7 @@ describe('onCronTick — happy path (credentials present)', () => {
147147 ) as never
148148
149149 const ctx = makeCtx ( { DB : makeDb ( ) , CF_ZONE_ID : 'zone' , EMAIL_API_TOKEN : 'tok' } )
150- await onCronTick ( ctx , { type : 'cron:tick' , schedule : '*/5 * * * *' , hookFamily : 'email-reconciliation' , triggeredAt : 1700000000000 } )
150+ await onCronTick ( { type : 'cron:tick' , schedule : '*/5 * * * *' , hookFamily : 'email-reconciliation' , triggeredAt : 1700000000000 } , ctx )
151151
152152 expect ( log ) . toHaveBeenCalledWith (
153153 expect . stringContaining ( 'reconciliation cron: ok' ) ,
@@ -163,7 +163,7 @@ describe('onCronTick — happy path (credentials present)', () => {
163163 globalThis . fetch = vi . fn ( async ( ) => new Response ( 'Internal Server Error' , { status : 500 } ) ) as never
164164
165165 const ctx = makeCtx ( { DB : makeDb ( ) , CF_ZONE_ID : 'zone' , EMAIL_API_TOKEN : 'tok' } )
166- await onCronTick ( ctx , { type : 'cron:tick' , schedule : '*/5 * * * *' , hookFamily : 'email-reconciliation' , triggeredAt : 0 } )
166+ await onCronTick ( { type : 'cron:tick' , schedule : '*/5 * * * *' , hookFamily : 'email-reconciliation' , triggeredAt : 0 } , ctx )
167167
168168 expect ( warn ) . toHaveBeenCalledWith (
169169 expect . stringContaining ( 'GraphQL error' ) ,
@@ -190,7 +190,7 @@ describe('onCronTick — D1 settings fallback', () => {
190190 } ) ) ,
191191 } as unknown as D1Database
192192 const ctx = makeCtx ( { DB : db , CF_ZONE_ID : 'zone' } ) // EMAIL_API_TOKEN absent
193- await onCronTick ( ctx , { type : 'cron:tick' , schedule : '*/5 * * * *' , hookFamily : 'email-reconciliation' , triggeredAt : 0 } )
193+ await onCronTick ( { type : 'cron:tick' , schedule : '*/5 * * * *' , hookFamily : 'email-reconciliation' , triggeredAt : 0 } , ctx )
194194 expect ( debug ) . toHaveBeenCalledWith ( expect . stringContaining ( 'EMAIL_API_TOKEN read from D1' ) )
195195 } )
196196} )
0 commit comments