store: test the //close rollback when its refund is refused

This commit is contained in:
sh-agents committed 2026-11-09 13:58:42 +00:00
1 parent bce20b0297
commit a77b6ff302
1 file changed
+9 -1
+9 -1
View File
@@ -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