@@ -221,7 +221,13 @@ describe('CaseSearchProcessor', () => {
221221 // Should queue for search (processing cases get re-queued in case they're stuck)
222222 expect ( mockQueueClient . queueCasesForSearch ) . toHaveBeenCalledWith ( [ '22CR123456-789' ] , 'test-user-id' , 'Test Agent' ) ;
223223 expect ( mockQueueClient . queueCaseForDataRetrieval ) . not . toHaveBeenCalled ( ) ;
224- expect ( mockStorageClient . saveCase ) . not . toHaveBeenCalled ( ) ;
224+ // Status should be saved to DynamoDB as 'queued'
225+ expect ( mockStorageClient . saveCase ) . toHaveBeenCalledWith ( {
226+ caseNumber : '22CR123456-789' ,
227+ fetchStatus : { status : 'queued' } ,
228+ caseId : 'test-case-id' ,
229+ lastUpdated : expect . any ( String ) ,
230+ } ) ;
225231 } ) ;
226232
227233 it ( 'should handle cases with notFound status (should queue for search retry)' , async ( ) => {
@@ -244,7 +250,15 @@ describe('CaseSearchProcessor', () => {
244250 // Should queue for search retry, in case the record is not actually in-queue
245251 expect ( mockQueueClient . queueCaseForDataRetrieval ) . not . toHaveBeenCalled ( ) ;
246252 expect ( mockQueueClient . queueCasesForSearch ) . toHaveBeenCalledWith ( [ '22CR123456-789' ] , 'test-user-id' , 'Test Agent' ) ;
247- expect ( mockStorageClient . saveCase ) . not . toHaveBeenCalled ( ) ;
253+ // Status should be saved to DynamoDB as 'queued'
254+ expect ( mockStorageClient . saveCase ) . toHaveBeenCalledWith ( {
255+ caseNumber : '22CR123456-789' ,
256+ fetchStatus : { status : 'queued' } ,
257+ caseId : undefined ,
258+ lastUpdated : expect . any ( String ) ,
259+ } ) ;
260+ // Status should be updated to 'queued' in the response for the UI
261+ expect ( result . results [ '22CR123456-789' ] . zipCase . fetchStatus . status ) . toBe ( 'queued' ) ;
248262 } ) ;
249263
250264 it ( 'should handle cases with failed status (should queue for search)' , async ( ) => {
@@ -267,7 +281,15 @@ describe('CaseSearchProcessor', () => {
267281 // Should queue for search (failed status gets re-queued)
268282 expect ( mockQueueClient . queueCasesForSearch ) . toHaveBeenCalledWith ( [ '22CR123456-789' ] , 'test-user-id' , 'Test Agent' ) ;
269283 expect ( mockQueueClient . queueCaseForDataRetrieval ) . not . toHaveBeenCalled ( ) ;
270- expect ( mockStorageClient . saveCase ) . not . toHaveBeenCalled ( ) ;
284+ // Status should be saved to DynamoDB as 'queued'
285+ expect ( mockStorageClient . saveCase ) . toHaveBeenCalledWith ( {
286+ caseNumber : '22CR123456-789' ,
287+ fetchStatus : { status : 'queued' } ,
288+ caseId : undefined ,
289+ lastUpdated : expect . any ( String ) ,
290+ } ) ;
291+ // Status should be updated to 'queued' in the response for the UI
292+ expect ( result . results [ '22CR123456-789' ] . zipCase . fetchStatus . status ) . toBe ( 'queued' ) ;
271293 } ) ;
272294
273295 it ( 'should handle new cases (not in storage)' , async ( ) => {
0 commit comments