@@ -98,7 +98,7 @@ export function runTests<TDatabase = unknown>(ctx: SharedTestContext<TDatabase>)
9898 expect ( job ?. name ) . toBe ( "job-1" ) // High priority first
9999 } )
100100
101- it . skip ( "should update job status" , async ( ) => {
101+ it ( "should update job status" , async ( ) => {
102102 const job = await adapter . addJob ( {
103103 name : "test-job" ,
104104 payload : { data : "test" } ,
@@ -111,12 +111,11 @@ export function runTests<TDatabase = unknown>(ctx: SharedTestContext<TDatabase>)
111111
112112 await adapter . updateJobStatus ( job . id , "processing" )
113113
114- // const [updated] = await db
115- // .select()
116- // .from(schema.queueJobs)
117- // .where(eq(schema.queueJobs.id, job.id))
118- // expect(updated?.status).toBe("processing")
119- // expect(updated?.processedAt).toBeTruthy()
114+ const [ updated ] : [ { progressed_at : number ; status : string } ?] =
115+ await internalDbClient `SELECT processed_at, status FROM queue_jobs WHERE id=${ job . id } `
116+
117+ expect ( updated ?. status ) . toBe ( "processing" )
118+ expect ( updated ?. progressed_at ) . toBeTruthy ( )
120119 } )
121120
122121 it ( "should get queue stats" , async ( ) => {
@@ -218,7 +217,7 @@ export function runTests<TDatabase = unknown>(ctx: SharedTestContext<TDatabase>)
218217 } )
219218 } )
220219
221- describe . skip ( "Result storage" , async ( ) => {
220+ describe ( "Result storage" , async ( ) => {
222221 it ( "should store job result when job completes" , async ( ) => {
223222 const job = await adapter . addJob ( {
224223 name : "test-job" ,
@@ -233,14 +232,12 @@ export function runTests<TDatabase = unknown>(ctx: SharedTestContext<TDatabase>)
233232 const result = { success : true , output : "processed" }
234233 await adapter . updateJobStatus ( job . id , "completed" , undefined , result )
235234
236- // const [updated] = await db
237- // .select()
238- // .from(schema.queueJobs)
239- // .where(eq(schema.queueJobs.id, job.id))
235+ const [ updated ] : [ { completed_at : number ; status : string ; result : unknown } ?] =
236+ await internalDbClient `SELECT completed_at, status, result FROM queue_jobs WHERE id=${ job . id } `
240237
241- // expect(updated?.status).toBe("completed")
242- // expect(updated?.result).toEqual(result)
243- // expect(updated?.completedAt ).toBeTruthy()
238+ expect ( updated ?. status ) . toBe ( "completed" )
239+ expect ( updated ?. result ) . toEqual ( result )
240+ expect ( updated ?. completed_at ) . toBeTruthy ( )
244241 } )
245242
246243 it ( "should handle null/undefined results" , async ( ) => {
@@ -256,12 +253,10 @@ export function runTests<TDatabase = unknown>(ctx: SharedTestContext<TDatabase>)
256253
257254 await adapter . updateJobStatus ( job . id , "completed" , undefined , null )
258255
259- // const [updated] = await db
260- // .select()
261- // .from(schema.queueJobs)
262- // .where(eq(schema.queueJobs.id, job.id))
256+ const [ updated ] : [ { result : unknown } ?] =
257+ await internalDbClient `SELECT result FROM queue_jobs WHERE id=${ job . id } `
263258
264- // expect(updated?.result).toBeNull()
259+ expect ( updated ?. result ) . toBeNull ( )
265260 } )
266261
267262 it ( "should preserve result in transformJob method" , async ( ) => {
@@ -281,13 +276,10 @@ export function runTests<TDatabase = unknown>(ctx: SharedTestContext<TDatabase>)
281276 const nextJob = await adapter . getNextJob ( )
282277 expect ( nextJob ) . toBeNull ( ) // No pending jobs
283278
284- // Get the completed job directly from database and transform
285- // const [dbJob] = await db
286- // .select()
287- // .from(schema.queueJobs)
288- // .where(eq(schema.queueJobs.id, job.id))
279+ const [ dbJob ] : [ { result : unknown } ?] =
280+ await internalDbClient `SELECT result FROM queue_jobs WHERE id=${ job . id } `
289281
290- // expect(dbJob?.result).toEqual(result)
282+ expect ( dbJob ?. result ) . toEqual ( result )
291283 } )
292284
293285 it ( "should not update result when not provided" , async ( ) => {
@@ -308,13 +300,11 @@ export function runTests<TDatabase = unknown>(ctx: SharedTestContext<TDatabase>)
308300 // Second update without result (should preserve existing result)
309301 await adapter . updateJobStatus ( job . id , "completed" )
310302
311- // const [updated] = await db
312- // .select()
313- // .from(schema.queueJobs)
314- // .where(eq(schema.queueJobs.id, job.id))
303+ const [ updated ] : [ { result : unknown ; status : string } ?] =
304+ await internalDbClient `SELECT result FROM queue_jobs WHERE id=${ job . id } `
315305
316- // expect(updated?.result).toEqual(result)
317- // expect(updated?.status).toBe("completed")
306+ expect ( updated ?. result ) . toEqual ( result )
307+ expect ( updated ?. status ) . toBe ( "completed" )
318308 } )
319309 } )
320310 } )
0 commit comments