@@ -6,7 +6,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
66
77vi . mock ( '@sim/logger' , ( ) => loggerMock )
88
9- import { JOB_RETENTION_SECONDS } from '@/lib/core/async-jobs/types'
9+ import { JOB_RETENTION_SECONDS , JOB_STATUS } from '@/lib/core/async-jobs/types'
1010import { RedisJobQueue } from './redis'
1111
1212describe ( 'RedisJobQueue' , ( ) => {
@@ -31,7 +31,7 @@ describe('RedisJobQueue', () => {
3131
3232 const [ key , data ] = localRedis . hset . mock . calls [ 0 ]
3333 expect ( key ) . toBe ( `async-jobs:job:${ jobId } ` )
34- expect ( data . status ) . toBe ( 'pending' )
34+ expect ( data . status ) . toBe ( JOB_STATUS . PENDING )
3535 expect ( data . type ) . toBe ( 'workflow-execution' )
3636 } )
3737
@@ -54,7 +54,7 @@ describe('RedisJobQueue', () => {
5454 await localQueue . completeJob ( jobId , { result : 'success' } )
5555
5656 expect ( localRedis . hset ) . toHaveBeenCalledWith ( `async-jobs:job:${ jobId } ` , {
57- status : 'completed' ,
57+ status : JOB_STATUS . COMPLETED ,
5858 completedAt : expect . any ( String ) ,
5959 output : JSON . stringify ( { result : 'success' } ) ,
6060 updatedAt : expect . any ( String ) ,
@@ -85,7 +85,7 @@ describe('RedisJobQueue', () => {
8585 await localQueue . markJobFailed ( jobId , error )
8686
8787 expect ( localRedis . hset ) . toHaveBeenCalledWith ( `async-jobs:job:${ jobId } ` , {
88- status : 'failed' ,
88+ status : JOB_STATUS . FAILED ,
8989 completedAt : expect . any ( String ) ,
9090 error,
9191 updatedAt : expect . any ( String ) ,
@@ -137,7 +137,7 @@ describe('RedisJobQueue', () => {
137137 id : 'run_test' ,
138138 type : 'workflow-execution' ,
139139 payload : JSON . stringify ( { foo : 'bar' } ) ,
140- status : 'completed' ,
140+ status : JOB_STATUS . COMPLETED ,
141141 createdAt : now . toISOString ( ) ,
142142 startedAt : now . toISOString ( ) ,
143143 completedAt : now . toISOString ( ) ,
@@ -154,7 +154,7 @@ describe('RedisJobQueue', () => {
154154 expect ( job ?. id ) . toBe ( 'run_test' )
155155 expect ( job ?. type ) . toBe ( 'workflow-execution' )
156156 expect ( job ?. payload ) . toEqual ( { foo : 'bar' } )
157- expect ( job ?. status ) . toBe ( 'completed' )
157+ expect ( job ?. status ) . toBe ( JOB_STATUS . COMPLETED )
158158 expect ( job ?. output ) . toEqual ( { result : 'ok' } )
159159 expect ( job ?. metadata . workflowId ) . toBe ( 'wf_123' )
160160 } )
0 commit comments