1
1
module Spec.BotPlutusInterface.ContractStats (tests ) where
2
2
3
- import BotPlutusInterface.Types
4
- ( ContractEnvironment (cePABConfig ),
5
- PABConfig (pcCollectStats , pcOwnPubKeyHash ),
6
- )
3
+ import BotPlutusInterface.Types (
4
+ ContractEnvironment (cePABConfig ),
5
+ PABConfig (pcCollectStats , pcOwnPubKeyHash ),
6
+ )
7
7
import Control.Lens ((&) , (.~) , (^.) )
8
8
import Data.Default (def )
9
9
import Data.Text (Text )
@@ -12,21 +12,21 @@ import Ledger (PaymentPubKeyHash (unPaymentPubKeyHash))
12
12
import Ledger.Ada qualified as Ada
13
13
import Ledger.Constraints qualified as Constraints
14
14
import 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
+ )
30
30
import Test.Tasty (TestTree , testGroup )
31
31
import Test.Tasty.HUnit (Assertion , assertFailure , testCase , (@?=) )
32
32
import Prelude
@@ -35,8 +35,8 @@ tests :: TestTree
35
35
tests =
36
36
testGroup
37
37
" 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
40
40
]
41
41
42
42
budgetSavingEnabled :: Assertion
@@ -46,14 +46,8 @@ budgetSavingEnabled = do
46
46
initState =
47
47
def & utxos .~ [(txOutRef, txOut)]
48
48
& 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}
57
51
58
52
contract :: Contract () (Endpoint " SendAda" () ) Text CardanoTx
59
53
contract = do
0 commit comments