@@ -4507,6 +4507,44 @@ it.layer(layerSharedApplicationDataPlaneTest)("snooze projection", (it) => {
45074507 snoozedUntil,
45084508 } ) ;
45094509
4510+ yield * orchestrator . dispatch ( {
4511+ type : "thread.pin" ,
4512+ commandId : CommandId . make ( "runtime-layer-snoozed-thread-pin-wake" ) ,
4513+ threadId,
4514+ orderKey : "a0" ,
4515+ } ) ;
4516+ const pinAwakened = yield * orchestrator . getThreadProjection ( threadId ) ;
4517+ const pinWakeAt = yield * DateTime . now ;
4518+ assert . deepEqual ( pinAwakened . thread . lastSnoozeWakeAt , pinWakeAt ) ;
4519+ assert . isNull ( pinAwakened . thread . snoozedUntil ) ;
4520+ assert . isNull ( pinAwakened . thread . snoozedAt ) ;
4521+ assert . deepEqual ( pinAwakened . thread . unsettledAt , firstProjection . thread . unsettledAt ) ;
4522+ yield * TestClock . adjust ( "10 seconds" ) ;
4523+ yield * orchestrator . dispatch ( {
4524+ type : "thread.pin" ,
4525+ commandId : CommandId . make ( "runtime-layer-snoozed-thread-pin-again" ) ,
4526+ threadId,
4527+ orderKey : "a1" ,
4528+ } ) ;
4529+ const pinnedAgain = yield * orchestrator . getThreadProjection ( threadId ) ;
4530+ assert . deepEqual ( pinnedAgain . thread . lastSnoozeWakeAt , pinWakeAt ) ;
4531+ assert . equal ( pinnedAgain . thread . pinOrderKey , "a0" ) ;
4532+ yield * orchestrator . dispatch ( {
4533+ type : "thread.unpin" ,
4534+ commandId : CommandId . make ( "runtime-layer-snoozed-thread-unpin-after-wake" ) ,
4535+ threadId,
4536+ } ) ;
4537+ assert . deepEqual (
4538+ ( yield * projections . getSettlementCandidates ( threadId ) ) [ 0 ] ?. lastSnoozeWakeAt ,
4539+ pinWakeAt ,
4540+ ) ;
4541+ yield * orchestrator . dispatch ( {
4542+ type : "thread.snooze" ,
4543+ commandId : CommandId . make ( "runtime-layer-snoozed-thread-snooze-after-pin" ) ,
4544+ threadId,
4545+ snoozedUntil,
4546+ } ) ;
4547+
45104548 yield * orchestrator . dispatch ( {
45114549 type : "message.dispatch" ,
45124550 createdBy : "user" ,
0 commit comments