Skip to content

Commit

Permalink
Add negative tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosLopezDeLara committed Jul 5, 2024
1 parent 40394b8 commit 7535c58
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ test-suite cardano-cli-golden
Test.Golden.CreateStaked
Test.Golden.CreateTestnetData
Test.Golden.Conway.Transaction.Assemble
Test.Golden.Conway.Transaction.BuildRaw
Test.Golden.EraBased.Governance.AnswerPoll
Test.Golden.EraBased.Governance.CreatePoll
Test.Golden.EraBased.Governance.VerifyPoll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,40 @@ hprop_golden_conway_build_raw_treasury_donation = propertyOnce . H.moduleWorkspa

H.diffFileVsGoldenFile outFile goldenFile

-- Negative test: Missing --current-treasury-value
-- | Execute me with:
-- @cabal test cardano-cli-golden --test-options '-p "/golden conway build raw donation no current treasury value/"'@
hprop_golden_conway_build_raw_donation_no_current_treasury_value :: Property
hprop_golden_conway_build_raw_donation_no_current_treasury_value = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do

-- Key filepaths
outFile <- noteTempFile tempDir "out.json"

void $ execDetailCardanoCLI
[ "conway", "transaction", "build-raw"
, "--tx-in", "f62cd7bc15d8c6d2c8519fb8d13c57c0157ab6bab50af62bc63706feb966393d#0"
, "--tx-out", "addr_test1qpmxr8d8jcl25kyz2tz9a9sxv7jxglhddyf475045y8j3zxjcg9vquzkljyfn3rasfwwlkwu7hhm59gzxmsyxf3w9dps8832xh+1199989833223"
, "--tx-out", "addr_test1vpqgspvmh6m2m5pwangvdg499srfzre2dd96qq57nlnw6yctpasy4+10000000"
, "--treasury-donation", "1000343"
, "--fee", "166777"
, "--out-file", outFile
]

-- Negative test: Missing --current-treasury-value
-- | Execute me with:
-- @cabal test cardano-cli-golden --test-options '-p "/ggolden conway build raw donation no treasury donation/"'@
hprop_golden_conway_build_raw_donation_no_treasury_donation :: Property
hprop_golden_conway_build_raw_donation_no_treasury_donation = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do

-- Key filepaths
outFile <- noteTempFile tempDir "out.json"

void $ execDetailCardanoCLI
[ "conway", "transaction", "build-raw"
, "--tx-in", "f62cd7bc15d8c6d2c8519fb8d13c57c0157ab6bab50af62bc63706feb966393d#0"
, "--tx-out", "addr_test1qpmxr8d8jcl25kyz2tz9a9sxv7jxglhddyf475045y8j3zxjcg9vquzkljyfn3rasfwwlkwu7hhm59gzxmsyxf3w9dps8832xh+1199989833223"
, "--tx-out", "addr_test1vpqgspvmh6m2m5pwangvdg499srfzre2dd96qq57nlnw6yctpasy4+10000000"
, "--current-treasury-value", "543"
, "--fee", "166777"
, "--out-file", outFile
]

0 comments on commit 7535c58

Please sign in to comment.