11module Spec.BotPlutusInterface.ContractStats (tests ) where
22
3- import BotPlutusInterface.Types
4- ( ContractEnvironment (cePABConfig ),
5- PABConfig (pcCollectStats , pcOwnPubKeyHash ),
6- )
3+ import BotPlutusInterface.Types (
4+ ContractEnvironment (cePABConfig ),
5+ PABConfig (pcCollectStats , pcOwnPubKeyHash ),
6+ )
77import Control.Lens ((&) , (.~) , (^.) )
88import Data.Default (def )
99import Data.Text (Text )
@@ -12,21 +12,21 @@ import Ledger (PaymentPubKeyHash (unPaymentPubKeyHash))
1212import Ledger.Ada qualified as Ada
1313import Ledger.Constraints qualified as Constraints
1414import Ledger.Tx (CardanoTx , TxOut (TxOut ), TxOutRef (TxOutRef ))
15- import Plutus.Contract
16- ( Contract (.. ),
17- Endpoint ,
18- submitTx ,
19- )
20- import Spec.MockContract
21- ( contractEnv ,
22- mockBudget ,
23- paymentPkh1 ,
24- paymentPkh2 ,
25- pkhAddr1 ,
26- runContractPure ,
27- statsUpdates ,
28- utxos ,
29- )
15+ import Plutus.Contract (
16+ Contract (.. ),
17+ Endpoint ,
18+ submitTx ,
19+ )
20+ import Spec.MockContract (
21+ contractEnv ,
22+ mockBudget ,
23+ paymentPkh1 ,
24+ paymentPkh2 ,
25+ pkhAddr1 ,
26+ runContractPure ,
27+ statsUpdates ,
28+ utxos ,
29+ )
3030import Test.Tasty (TestTree , testGroup )
3131import Test.Tasty.HUnit (Assertion , assertFailure , testCase , (@?=) )
3232import Prelude
@@ -35,8 +35,8 @@ tests :: TestTree
3535tests =
3636 testGroup
3737 " Collecting contract stats"
38- [ testCase " Budget added when saving enabled" budgetSavingEnabled,
39- testCase " Budget NOT added with default (`False`) option" budgetSavingDisabled
38+ [ testCase " Budget added when saving enabled" budgetSavingEnabled
39+ , testCase " Budget NOT added with default (`False`) option" budgetSavingDisabled
4040 ]
4141
4242budgetSavingEnabled :: Assertion
@@ -46,14 +46,8 @@ budgetSavingEnabled = do
4646 initState =
4747 def & utxos .~ [(txOutRef, txOut)]
4848 & contractEnv .~ contractEnv'
49- contractEnv' =
50- def
51- { cePABConfig =
52- def
53- { pcOwnPubKeyHash = unPaymentPubKeyHash paymentPkh1,
54- pcCollectStats = True
55- }
56- }
49+ pabConf = def {pcOwnPubKeyHash = unPaymentPubKeyHash paymentPkh1, pcCollectStats = True }
50+ contractEnv' = def {cePABConfig = pabConf}
5751
5852 contract :: Contract () (Endpoint " SendAda" () ) Text CardanoTx
5953 contract = do
0 commit comments