Skip to content

Commit 9363466

Browse files
author
gege251
committed
Fix tests
1 parent efd5358 commit 9363466

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/BotPlutusInterface/Files.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
module BotPlutusInterface.Files (
44
policyScriptFilePath,
55
DummyPrivKey (FromSKey, FromVKey),
6+
unDummyPrivateKey,
67
validatorScriptFilePath,
78
readPrivateKeys,
89
signingKeyFilePath,

test/Spec/BotPlutusInterface/PreBalance.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Spec.BotPlutusInterface.PreBalance (tests) where
22

3+
import BotPlutusInterface.Files (DummyPrivKey (FromSKey))
34
import BotPlutusInterface.PreBalance qualified as PreBalance
45
import Cardano.Api.Shelley (Lovelace (Lovelace), ProtocolParameters (protocolParamUTxOCostPerWord))
56
import Data.Default (def)
@@ -10,7 +11,7 @@ import Ledger.Ada qualified as Ada
1011
import Ledger.Address (Address, PaymentPubKeyHash (PaymentPubKeyHash))
1112
import Ledger.Address qualified as Address
1213
import Ledger.CardanoWallet qualified as Wallet
13-
import Ledger.Crypto (PrivateKey, PubKeyHash)
14+
import Ledger.Crypto (PubKeyHash)
1415
import Ledger.Tx (Tx (..), TxIn (..), TxInType (..), TxOut (..), TxOutRef (..))
1516
import Ledger.Value qualified as Value
1617
import Test.Tasty (TestTree, testGroup)
@@ -30,8 +31,8 @@ tests =
3031
, testCase "Add utxos to cover change min utxo" addUtxosForChange
3132
]
3233

33-
privateKey1 :: PrivateKey
34-
privateKey1 = Address.unPaymentPrivateKey . Wallet.paymentPrivateKey $ Wallet.knownMockWallet 1
34+
privateKey1 :: DummyPrivKey
35+
privateKey1 = FromSKey . Address.unPaymentPrivateKey . Wallet.paymentPrivateKey $ Wallet.knownMockWallet 1
3536

3637
pkh1, pkh2 :: PubKeyHash
3738
pkh1 = Address.unPaymentPubKeyHash . Wallet.paymentPubKeyHash $ Wallet.knownMockWallet 1

test/Spec/MockContract.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ addr2 = unsafeSerialiseAddress Mainnet (Ledger.pubKeyHashAddress paymentPkh2 Not
147147
addr3 = unsafeSerialiseAddress Mainnet (Ledger.pubKeyHashAddress paymentPkh3 Nothing)
148148

149149
toPubKey :: SigningKey PaymentKey -> PubKey
150-
toPubKey = Ledger.toPublicKey . fromRight (error "Impossible happened") . Files.fromCardanoPaymentKey
150+
toPubKey =
151+
Ledger.toPublicKey
152+
. Files.unDummyPrivateKey
153+
. fromRight (error "Impossible happened")
154+
. Files.skeyToDummyPrivKey
151155

152156
toSigningKeyFile :: FilePath -> SigningKey PaymentKey -> (FilePath, MockFile)
153157
toSigningKeyFile signingKeyFileDir sKey =

0 commit comments

Comments
 (0)