@@ -5,6 +5,7 @@ module Test.Hydra.Cluster.FaucetSpec where
5
5
import Hydra.Prelude
6
6
import Test.Hydra.Prelude
7
7
8
+ import Cardano.Api.UTxO qualified as UTxO
8
9
import CardanoNode (withCardanoNodeDevnet )
9
10
import Control.Concurrent.Async (replicateConcurrently )
10
11
import Hydra.Cardano.Api (Coin (.. ), selectLovelace , txOutValue )
36
37
vk <- generate genVerificationKey
37
38
seedFromFaucet backend vk 1_000_000 tracer
38
39
-- 10 unique outputs
39
- length (fold utxos) `shouldBe` 10
40
+ length (UTxO. txOutputs $ fold utxos) `shouldBe` 10
40
41
41
42
describe " returnFundsToFaucet" $ do
42
43
it " does nothing if nothing to return" $ \ (tracer, backend) -> do
@@ -53,13 +54,13 @@ spec =
53
54
returnFundsToFaucet tracer backend actor
54
55
remaining <- Backend. queryUTxOFor backend QueryTip vk
55
56
finalFaucetFunds <- Backend. queryUTxOFor backend QueryTip faucetVk
56
- foldMap txOutValue remaining `shouldBe` mempty
57
+ UTxO. foldMap txOutValue remaining `shouldBe` mempty
57
58
58
59
-- check the faucet has one utxo extra in the end
59
- length finalFaucetFunds `shouldBe` length initialFaucetFunds + 1
60
+ length ( UTxO. txOutputs finalFaucetFunds) `shouldBe` length ( UTxO. txOutputs initialFaucetFunds) + 1
60
61
61
- let initialFaucetValue = selectLovelace (foldMap txOutValue initialFaucetFunds)
62
- let finalFaucetValue = selectLovelace (foldMap txOutValue finalFaucetFunds)
62
+ let initialFaucetValue = selectLovelace (UTxO. foldMap txOutValue initialFaucetFunds)
63
+ let finalFaucetValue = selectLovelace (UTxO. foldMap txOutValue finalFaucetFunds)
63
64
let difference = initialFaucetValue - finalFaucetValue
64
65
-- difference between starting faucet amount and final one should
65
66
-- just be the amount of paid fees
77
78
-- it squashed the UTxO
78
79
utxoAfter <- Backend. queryUTxOFor backend QueryTip vk
79
80
80
- length utxoAfter `shouldBe` 1
81
+ length ( UTxO. txOutputs utxoAfter) `shouldBe` 1
0 commit comments