Skip to content

Commit

Permalink
Governance/CreatePoll: goldenize a test
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Nov 2, 2023
1 parent e271909 commit d20ab39
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Hedgehog (Property)
import qualified Hedgehog as H
import qualified Hedgehog.Extras.Test.Base as H
import qualified Hedgehog.Extras.Test.File as H
import qualified Hedgehog.Extras.Test.Golden as H

{- HLINT ignore "Use camelCase" -}

Expand All @@ -30,8 +31,10 @@ hprop_golden_governanceCreatePoll =
noteInputFile "test/cardano-cli-golden/files/input/governance/create/basic.json"
>>= H.readFile
>>= (H.===) stdout
H.assertFileOccurences 1 "GovernancePoll" pollFile
H.assertEndsWithSingleNewline pollFile

goldenFile <- H.note "test/cardano-cli-golden/files/golden/governance/polls/create-poll-out.json"

H.diffFileVsGoldenFile pollFile goldenFile

hprop_golden_governanceCreateLongPoll :: Property
hprop_golden_governanceCreateLongPoll =
Expand All @@ -50,5 +53,7 @@ hprop_golden_governanceCreateLongPoll =
noteInputFile "test/cardano-cli-golden/files/input/governance/create/long-text.json"
>>= H.readFile
>>= (H.===) stdout
H.assertFileOccurences 1 "GovernancePoll" pollFile
H.assertEndsWithSingleNewline pollFile

goldenFile <- H.note "test/cardano-cli-golden/files/golden/governance/polls/create-poll-long-text-out.json"

H.diffFileVsGoldenFile pollFile goldenFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "GovernancePoll",
"description": "An on-chain poll for SPOs: What is the most adequate topping to put on a pizza (please consider all possibilities and take time to answer)?",
"cborHex": "a1185ea2008278405768617420697320746865206d6f737420616465717561746520746f7070696e6720746f20707574206f6e20612070697a7a612028706c6561736520636f6e7378306964657220616c6c20706f73736962696c697469657320616e642074616b652074696d6520746f20616e73776572293f0182816a70696e656170706c65738278406f6e6c7920747261646974696f6e616c20746f706963732073686f756c6420676f206f6e20612070697a7a612c20746869732069736e277420726f6f6d20666f6772206a6f6b6573"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "GovernancePoll",
"description": "An on-chain poll for SPOs: Pineapples on pizza?",
"cborHex": "a1185ea200817450696e656170706c6573206f6e2070697a7a613f0182816379657381626e6f"
}

0 comments on commit d20ab39

Please sign in to comment.