@@ -268,10 +268,10 @@ describe("Unit test for app handler", function () {
268268
269269 it ( "times-out if spine call takes too long" , async ( ) => {
270270 const mockErrorLogger = jest . spyOn ( Logger . prototype , "error" )
271- const delayedResponse : Promise < Array < unknown > > = new Promise ( ( resolve ) => setTimeout ( ( ) => resolve ( [ ] ) , 15_000 ) )
272271 // eslint-disable-next-line @typescript-eslint/no-unused-vars
273- mock . onGet ( "https://live/mm/patientfacingprescriptions" ) . reply ( ( _config ) => delayedResponse )
274-
272+ mock . onGet ( "https://live/mm/patientfacingprescriptions" ) . reply ( function ( config ) {
273+ return new Promise ( ( resolve ) => setTimeout ( ( ) => resolve ( [ 200 , { } ] ) , 15_000 ) )
274+ } )
275275 const event : GetMyPrescriptionsEvent = JSON . parse ( exampleStateMachineEvent )
276276 const eventHandler : Promise < LambdaResult > = handler ( event , dummyContext )
277277
@@ -300,9 +300,11 @@ describe("Unit test for app handler", function () {
300300 params : handlerParams ,
301301 middleware : [ ]
302302 } )
303- const delayedResponse : Promise < Array < unknown > > = new Promise ( ( resolve ) => setTimeout ( ( ) => resolve ( [ ] ) , 5_000 ) )
303+
304304 // eslint-disable-next-line @typescript-eslint/no-unused-vars
305- mock . onGet ( "https://live/mm/patientfacingprescriptions" ) . reply ( ( _config ) => delayedResponse )
305+ mock . onGet ( "https://live/mm/patientfacingprescriptions" ) . reply ( function ( config ) {
306+ return new Promise ( ( resolve ) => setTimeout ( ( ) => resolve ( [ 200 , { } ] ) , 5_000 ) )
307+ } )
306308
307309 const event : GetMyPrescriptionsEvent = JSON . parse ( exampleStateMachineEvent )
308310 const eventHandler : Promise < LambdaResult > = handler ( event , dummyContext )
@@ -429,9 +431,10 @@ describe("Unit tests for app handler including service search", function () {
429431 const exampleResponse = { resourceType : "Bundle" }
430432 mock . onGet ( "https://spine/mm/patientfacingprescriptions" ) . reply ( 200 , exampleResponse )
431433
432- const delayedResponse : Promise < Array < unknown > > = new Promise ( ( resolve ) => setTimeout ( ( ) => resolve ( [ ] ) , 15_000 ) )
433434 // eslint-disable-next-line @typescript-eslint/no-unused-vars
434- mock . onGet ( "https://service-search/service-search" ) . reply ( ( _config ) => delayedResponse )
435+ mock . onGet ( "https://service-search/service-search" ) . reply ( function ( config ) {
436+ return new Promise ( ( resolve ) => setTimeout ( ( ) => resolve ( [ 200 , { } ] ) , 15_000 ) )
437+ } )
435438
436439 const event : GetMyPrescriptionsEvent = JSON . parse ( exampleStateMachineEvent )
437440 const eventHandler : Promise < LambdaResult > = handler ( event , dummyContext )
0 commit comments