@@ -144,7 +144,7 @@ describe("Unit test persistDataItems", () => {
144144 ApplicationID : "550e8400-e29b-41d4-a716-446655440000" ,
145145 ExpiryTime : 10
146146 }
147- const dataItems = Array ( 150 ) . fill ( dataItem )
147+ const dataItems = new Array ( 150 ) . fill ( dataItem )
148148
149149 const loggerSpy = vi . spyOn ( logger , "error" )
150150
@@ -367,7 +367,7 @@ describe("Unit test rollbackDataItems", () => {
367367 const items = [ makeItem ( ) , makeItem ( { PrescriptionID : "PrescriptionID_2" , TaskID : "TaskID_2" } ) ]
368368
369369 // success for each conditioned delete
370- mockSend . mockImplementation ( async ( ) => Promise . resolve ( ) )
370+ mockSend . mockImplementation ( async ( ) => { } )
371371
372372 const loggerWarn = vi . spyOn ( logger , "warn" )
373373 const loggerError = vi . spyOn ( logger , "error" )
@@ -384,14 +384,14 @@ describe("Unit test rollbackDataItems", () => {
384384
385385 // First delete succeeds, second hits conditional check failure (skip it)
386386 mockSend
387- . mockImplementationOnce ( async ( ) => Promise . resolve ( ) )
388- . mockImplementationOnce ( async ( ) => Promise . reject (
389- new TransactionCanceledException ( {
387+ . mockImplementationOnce ( async ( ) => { } )
388+ . mockImplementationOnce ( async ( ) => {
389+ throw new TransactionCanceledException ( {
390390 $metadata : { } ,
391391 message : "Conditional check failed" ,
392392 CancellationReasons : [ { Code : "ConditionalCheckFailedException" } ]
393393 } )
394- ) )
394+ } )
395395
396396 const loggerWarn = vi . spyOn ( logger , "warn" )
397397 const loggerError = vi . spyOn ( logger , "error" )
@@ -406,7 +406,9 @@ describe("Unit test rollbackDataItems", () => {
406406 it ( "returns false when an unexpected error occurs" , async ( ) => {
407407 const items = [ makeItem ( ) ]
408408
409- mockSend . mockImplementationOnce ( async ( ) => Promise . reject ( new Error ( "error" ) ) )
409+ mockSend . mockImplementationOnce ( async ( ) => {
410+ throw new Error ( "error" )
411+ } )
410412
411413 const loggerError = vi . spyOn ( logger , "error" )
412414
@@ -420,15 +422,15 @@ describe("Unit test rollbackDataItems", () => {
420422 const items = [ makeItem ( { TaskID : "A" } ) , makeItem ( { TaskID : "B" } ) , makeItem ( { TaskID : "C" } ) ]
421423
422424 mockSend
423- . mockImplementationOnce ( async ( ) => Promise . resolve ( ) ) // A: delete ok
424- . mockImplementationOnce ( async ( ) => Promise . reject ( // B: condition failure -> skip
425- new TransactionCanceledException ( {
425+ . mockImplementationOnce ( async ( ) => { } ) // A: delete ok
426+ . mockImplementationOnce ( async ( ) => { // B: condition failure -> skip
427+ throw new TransactionCanceledException ( {
426428 $metadata : { } ,
427429 message : "Conditional check failed" ,
428430 CancellationReasons : [ { Code : "ConditionalCheckFailedException" } ]
429431 } )
430- ) )
431- . mockImplementationOnce ( async ( ) => Promise . resolve ( ) ) // C: delete ok
432+ } )
433+ . mockImplementationOnce ( async ( ) => { } ) // C: delete ok
432434
433435 const loggerWarn = vi . spyOn ( logger , "warn" )
434436 const loggerError = vi . spyOn ( logger , "error" )
0 commit comments