@@ -194,14 +194,14 @@ const scenarios: Array<scenariosType> = [
194194 itemId : "item_1" ,
195195 latestStatus : "With pharmacy" ,
196196 isTerminalState : false ,
197- lastUpdateDateTime : "1970-01-03T00:00:00Z" // Back to 'With pharmacy'
197+ lastUpdateDateTime : "1970-01-03T00:00:00Z" // revoke RTC, back to 'With pharmacy'
198198 } ,
199199 {
200200 itemId : "item_1" ,
201201 latestStatus : "Ready to collect" ,
202202 isTerminalState : false ,
203203 lastUpdateDateTime : "1970-01-04T00:00:00Z" ,
204- postDatedLastModifiedSetAt : "1970-01-03T00:00:00Z " // third RTC: post-dated and matured
204+ postDatedLastModifiedSetAt : "1970-01-03T00:00:01Z " // third RTC: post-dated and matured
205205 }
206206 ] ,
207207 expectedResult : {
@@ -219,7 +219,7 @@ const scenarios: Array<scenariosType> = [
219219 latestStatus : "Ready to collect" ,
220220 isTerminalState : false ,
221221 lastUpdateDateTime : "1970-01-04T00:00:00Z" ,
222- postDatedLastModifiedSetAt : "1970-01-03T00:00:00Z "
222+ postDatedLastModifiedSetAt : "1970-01-03T00:00:01Z "
223223 }
224224 ]
225225 }
@@ -302,6 +302,48 @@ const scenarios: Array<scenariosType> = [
302302 }
303303 ]
304304 }
305+ } ,
306+ {
307+ scenarioDescription : "should return With pharmacy when RTC has been revoked but later RTC has matured" ,
308+ currentTime : new Date ( "2025-12-11T19:00:00Z" ) . getTime ( ) ,
309+ inputPrescriptions : {
310+ prescriptionID : "abc" ,
311+ odsCode : "123"
312+ } ,
313+ queryResults : [
314+ {
315+ itemId : "item_1" ,
316+ latestStatus : "Ready to collect" ,
317+ isTerminalState : false ,
318+ lastUpdateDateTime : "2025-12-11T19:00:00Z" ,
319+ postDatedLastModifiedSetAt : "2025-12-10T13:00:00Z"
320+ } ,
321+ {
322+ itemId : "item_1" ,
323+ latestStatus : "With pharmacy" ,
324+ isTerminalState : false ,
325+ lastUpdateDateTime : "2025-12-10T11:00:00Z"
326+ }
327+ ] ,
328+ expectedResult : {
329+ prescriptionID : "abc" ,
330+ onboarded : true ,
331+ items : [
332+ {
333+ itemId : "item_1" ,
334+ latestStatus : "With pharmacy" ,
335+ isTerminalState : false ,
336+ lastUpdateDateTime : "2025-12-10T11:00:00Z"
337+ } ,
338+ {
339+ itemId : "item_1" ,
340+ latestStatus : "Ready to collect" ,
341+ isTerminalState : false ,
342+ lastUpdateDateTime : "2025-12-11T19:00:00Z" ,
343+ postDatedLastModifiedSetAt : "2025-12-10T13:00:00Z"
344+ }
345+ ]
346+ }
305347 }
306348]
307349describe ( "Unit tests for buildResults" , ( ) => {
0 commit comments