From a77b6ff302ebdeefa8f08a1ea58eafad5beeba94 Mon Sep 17 00:00:00 2001 From: sh-agents <350651734+sh-agents@users.noreply.github.com> Date: Mon, 9 Nov 2026 13:58:42 +0000 Subject: [PATCH] store: test the //close rollback when its refund is refused --- tests/Bots/StoreService/NamesWorkerTests.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/Bots/StoreService/NamesWorkerTests.hs b/tests/Bots/StoreService/NamesWorkerTests.hs index 6b83ed19a8..c110ef2cb1 100644 --- a/tests/Bots/StoreService/NamesWorkerTests.hs +++ b/tests/Bots/StoreService/NamesWorkerTests.hs @@ -143,7 +143,8 @@ workerTests = describe "StoreService names: worker" $ do it "registers a failed order whose owner holds the name, and one whose register row mined while the owner no longer holds it, refunding nothing" testCloseLanded it "refuses an unknown reference, an order not failed, a failed code order and a failed chain read, changing nothing" testCloseRefused it "refuses an order changed during its chain check as changed, writing nothing" testCloseLostRace - it "refuses a balance another order holds, rolling back the taken write and the credit, and refunds the whole balance once released" testCloseHeld + it "refuses a balance another order holds, writing nothing, and refunds the whole balance once released" testCloseHeld + it "rolls back the taken write and the credit when the refund is refused" testCloseRollback -- fixtures @@ -1360,6 +1361,13 @@ testCloseLostRace = withWorker $ \W {wCtx = ctx@Ctx {cNode}} -> do stored ctx r `shouldReturn` changed figuresOf ctx r `shouldReturn` Nothing +testCloseRollback :: IO () +testCloseRollback = withWorker $ \W {wCtx = ctx} -> do + r <- paidIn ctx aliceOrder $ \o -> (failedPhase o) {nrPrice = 0} + closeOf ctx r `shouldReturn` CLRefused CFBalanceChanged + stored ctx r `shouldReturn` r + figuresOf ctx r `shouldReturn` Nothing + testCloseHeld :: IO () testCloseHeld = withWorker $ \W {wCtx = ctx@Ctx {cStore}} -> do r <- paidIn ctx dynamisOrder failedPhase