Skip to content

Commit 8f8423d

Browse files
author
gege251
committed
Test that the sign command is not called for txs with vkeys
1 parent 992b1dc commit 8f8423d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/Spec/BotPlutusInterface/Contract.hs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ withoutSigning = do
330330
submitTx constraints
331331

332332
-- Building and siging the tx should include both signing keys
333-
assertContractWithTxId contract initState $ \state outTxId ->
333+
assertContractWithTxId contract initState $ \state outTxId -> do
334334
assertCommandHistory
335335
state
336336
[
@@ -347,6 +347,7 @@ withoutSigning = do
347347
|]
348348
)
349349
]
350+
assertCommandNotCalled state "cardano-cli transaction sign"
350351

351352
sendTokens :: Assertion
352353
sendTokens = do
@@ -852,3 +853,15 @@ assertCommandHistory state =
852853
( \(idx, expectedCmd) ->
853854
(state ^? commandHistory . ix idx) @?= Just (Text.replace "\n" " " expectedCmd)
854855
)
856+
857+
assertCommandCalled :: forall (w :: Type). MockContractState w -> Text -> Assertion
858+
assertCommandCalled state expectedCmd =
859+
assertBool
860+
(Text.unpack . Text.unlines $ ["Command was not called:", expectedCmd])
861+
(any (Text.isInfixOf (Text.replace "\n" " " expectedCmd)) (state ^. commandHistory))
862+
863+
assertCommandNotCalled :: forall (w :: Type). MockContractState w -> Text -> Assertion
864+
assertCommandNotCalled state expectedCmd =
865+
assertBool
866+
(Text.unpack . Text.unlines $ ["Command was called:", expectedCmd])
867+
(not (any (Text.isInfixOf (Text.replace "\n" " " expectedCmd)) (state ^. commandHistory)))

0 commit comments

Comments
 (0)