add tests for minting GST

This commit is contained in:
Hongrui Fang 2022-07-17 21:56:29 +08:00
parent 7c3825ceba
commit eba58106f3
4 changed files with 282 additions and 22 deletions

View file

@ -14,15 +14,15 @@ TODO: Add negative test cases, see [#76](https://github.com/Liqwid-Labs/agora/is
module Spec.Governor (specs) where
import Agora.Governor (GovernorDatum (..), GovernorRedeemer (..))
import Agora.Governor.Scripts (governorPolicy, governorValidator)
import Agora.Governor.Scripts (governorValidator)
import Agora.Proposal (ProposalId (..))
import Data.Default.Class (Default (def))
import Sample.Governor (createProposal, mintGATs, mintGST, mutateState)
import Sample.Governor (mintGATs, mutateState)
import Sample.Governor.Initialize qualified as GST
import Sample.Shared qualified as Shared
import Test.Specification (
SpecificationTree,
group,
policySucceedsWith,
validatorSucceedsWith,
)
@ -31,27 +31,24 @@ specs :: [SpecificationTree]
specs =
[ group
"policy"
[ policySucceedsWith
"GST minting"
(governorPolicy Shared.governor)
()
mintGST
[ GST.mkTestCase "totally legal" GST.totallyValidParameters True
, group
"illegal"
[ GST.mkTestCase "invalid thresholds" GST.invalidDatumThresholdsParameters False
, GST.mkTestCase
"invalid max time range width for proposal creation"
GST.invalidDatumMaxTimeRangeWidthParameters
False
, GST.mkTestCase "invalid timings" GST.invalidDatumTimingConfigParameters False
, GST.mkTestCase "no governor datum" GST.withoutGovernorDatumParameters False
, GST.mkTestCase "no witness UTXO" GST.witnessNotPresentedParameters False
, GST.mkTestCase "mint more than one GST" GST.mintMoreThanOneGSTParameters False
, GST.mkTestCase "GST has non-empty name" GST.mintGSTWithNoneEmptyNameParameters False
]
]
, group
"validator"
[ validatorSucceedsWith
"proposal creation"
(governorValidator Shared.governor)
( GovernorDatum
def
(ProposalId 0)
def
def
3
)
CreateProposal
createProposal
, validatorSucceedsWith
"GATs minting"
(governorValidator Shared.governor)
( GovernorDatum