Skip to content

Commit 397b8a3

Browse files
committed
Fix CI
1 parent 70d219d commit 397b8a3

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

test/Main.purs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import Cardano.Transaction.Builder
1717
, WrongOutputType
1818
)
1919
, buildTransaction
20+
, modifyTransaction
2021
)
2122
import Cardano.Transaction.Edit (editTransaction, editTransactionSafe)
2223
import Cardano.Types
@@ -81,7 +82,7 @@ suite = do
8182
editorTests :: TestPlanM (Aff Unit) Unit
8283
editorTests = group "Cardano.Transaction.Edit" do
8384
let
84-
oneInput = mainnetTransaction
85+
oneInput = anyNetworkTx
8586
# _witnessSet <<< _redeemers .~
8687
[ Redeemer
8788
{ index: BigNum.zero
@@ -97,7 +98,7 @@ editorTests = group "Cardano.Transaction.Edit" do
9798
editTransaction identity oneInput `shouldEqual` oneInput
9899
test "attach one input to the end" do
99100
let
100-
tx' = mainnetTransaction
101+
tx' = anyNetworkTx
101102
# _witnessSet <<< _redeemers .~
102103
[ Redeemer
103104
{ index: BigNum.zero
@@ -112,7 +113,7 @@ editorTests = group "Cardano.Transaction.Edit" do
112113
`shouldEqual` tx'
113114
test "remove two inputs, before and after" do
114115
let
115-
tx = mainnetTransaction
116+
tx = anyNetworkTx
116117
# _witnessSet <<< _redeemers .~
117118
[ Redeemer
118119
{ index: BigNum.one
@@ -122,7 +123,7 @@ editorTests = group "Cardano.Transaction.Edit" do
122123
}
123124
]
124125
# _body <<< _inputs .~ [ input0, input1, input2 ]
125-
tx' = mainnetTransaction
126+
tx' = anyNetworkTx
126127
# _witnessSet <<< _redeemers .~
127128
[ Redeemer
128129
{ index: BigNum.zero
@@ -137,7 +138,7 @@ editorTests = group "Cardano.Transaction.Edit" do
137138
`shouldEqual` pure tx'
138139
test "remove two inputs with redeemers, before and after" do
139140
let
140-
tx = mainnetTransaction
141+
tx = anyNetworkTx
141142
# _witnessSet <<< _redeemers .~
142143
[ Redeemer
143144
{ index: BigNum.zero
@@ -159,7 +160,7 @@ editorTests = group "Cardano.Transaction.Edit" do
159160
}
160161
]
161162
# _body <<< _inputs .~ [ input0, input1, input2 ]
162-
tx' = mainnetTransaction
163+
tx' = anyNetworkTx
163164
# _witnessSet <<< _redeemers .~
164165
[ Redeemer
165166
{ index: BigNum.zero
@@ -174,7 +175,7 @@ editorTests = group "Cardano.Transaction.Edit" do
174175
`shouldEqual` pure tx'
175176
test "remove input & redeemer, add another input & redeemer" do
176177
let
177-
tx = mainnetTransaction
178+
tx = anyNetworkTx
178179
# _witnessSet <<< _redeemers .~
179180
[ Redeemer
180181
{ index: BigNum.zero
@@ -190,7 +191,7 @@ editorTests = group "Cardano.Transaction.Edit" do
190191
}
191192
]
192193
# _body <<< _inputs .~ [ input1, input2 ]
193-
tx' = mainnetTransaction
194+
tx' = anyNetworkTx
194195
# _witnessSet <<< _redeemers .~
195196
-- order is swapped because of `nub`...
196197
[ Redeemer
@@ -236,10 +237,10 @@ builderTests = group "Cardano.Transaction.Builder" do
236237
PlutusScriptOutput (ScriptReference input1 SpendInput) RedeemerDatum.unit Nothing
237238
group "SpendOutput" do
238239
testBuilderSteps "PKH output" [ SpendOutput pkhUtxo Nothing ] $
239-
mainnetTransaction # _body <<< _inputs .~ [ input1 ]
240+
anyNetworkTx # _body <<< _inputs .~ [ input1 ]
240241
testBuilderSteps "PKH output x2 -> 1"
241242
[ SpendOutput pkhUtxo Nothing, SpendOutput pkhUtxo Nothing ] $
242-
mainnetTransaction # _body <<< _inputs .~ [ input1 ]
243+
anyNetworkTx # _body <<< _inputs .~ [ input1 ]
243244
testBuilderStepsFail "PKH output with wrong witness"
244245
[ SpendOutput pkhUtxo (Just nsWitness) ] $
245246
WrongOutputType ScriptHashWitness pkhUtxo
@@ -252,24 +253,24 @@ builderTests = group "Cardano.Transaction.Builder" do
252253
test "PKH output with wrong NetworkId" do
253254
let
254255
result =
255-
buildTransaction TestnetId
256+
modifyTransaction testnetTransaction
256257
[ SpendOutput pkhUtxo Nothing ]
257258
result `shouldEqual`
258259
Left (WrongNetworkId $ pkhUtxo ^. _output <<< _address)
259260
group "Pay" do
260261
testBuilderSteps "#1" [ Pay pkhOutput ] $
261-
mainnetTransaction # _body <<< _outputs .~ [ pkhOutput ]
262+
anyNetworkTx # _body <<< _outputs .~ [ pkhOutput ]
262263
group "MintAsset" do
263264
testBuilderSteps "#1" [ Pay pkhOutput ] $
264-
mainnetTransaction # _body <<< _outputs .~ [ pkhOutput ]
265+
anyNetworkTx # _body <<< _outputs .~ [ pkhOutput ]
265266
group "Deregister" do
266267
testBuilderSteps "Deregister script"
267268
[ IssueCertificate
268269
(StakeDeregistration (wrap $ ScriptHashCredential $ PlutusScript.hash script1))
269270
$ Just
270271
$ PlutusScriptCredential (ScriptValue script1) RedeemerDatum.unit
271272
] $
272-
mainnetTransaction
273+
anyNetworkTx
273274
# _witnessSet <<< _plutusScripts .~ [ script1 ]
274275
# _witnessSet <<< _redeemers .~
275276
[ Redeemer
@@ -304,7 +305,7 @@ testBuilderStepsFail
304305
-> TestPlanM (Aff Unit) Unit
305306
testBuilderStepsFail label steps err = test label do
306307
let
307-
result = buildTransaction MainnetId steps
308+
result = buildTransaction steps
308309
result `shouldEqual` Left err
309310

310311
testBuilderSteps
@@ -314,7 +315,7 @@ testBuilderSteps
314315
-> TestPlanM (Aff Unit) Unit
315316
testBuilderSteps label steps expected = test label do
316317
let
317-
result = buildTransaction MainnetId steps
318+
result = buildTransaction steps
318319
result `shouldEqual` Right expected
319320

320321
pkhOutput :: TransactionOutput
@@ -426,5 +427,8 @@ script1 = unsafePartial $ fromJust $ decodeCbor $ wrap $ hexToByteArrayUnsafe "4
426427
script2 :: PlutusScript
427428
script2 = unsafePartial $ fromJust $ decodeCbor $ wrap $ hexToByteArrayUnsafe "4e4d01000033222220051200120012"
428429

429-
mainnetTransaction :: Transaction
430-
mainnetTransaction = Transaction.empty # _body <<< _networkId .~ Just MainnetId
430+
anyNetworkTx :: Transaction
431+
anyNetworkTx = Transaction.empty
432+
433+
testnetTransaction :: Transaction
434+
testnetTransaction = Transaction.empty # _body <<< _networkId .~ Just TestnetId

0 commit comments

Comments
 (0)