add checks to cosign

This commit is contained in:
Emily Martins 2022-04-19 22:31:38 +02:00
parent 832e15fc16
commit 1e972f1402
7 changed files with 241 additions and 44 deletions

View file

@ -13,9 +13,26 @@ module Spec.Proposal (tests) where
--------------------------------------------------------------------------------
import Agora.Proposal (proposalPolicy)
import Agora.Proposal (
ProposalDatum (ProposalDatum),
ProposalId (ProposalId),
ProposalRedeemer (Cosign),
ProposalStatus (Draft),
ProposalVotes (ProposalVotes),
ResultTag (ResultTag),
cosigners,
effects,
proposalId,
proposalPolicy,
proposalValidator,
status,
thresholds,
votes,
)
import PlutusTx.AssocMap qualified as AssocMap
import Spec.Sample.Proposal (propThresholds, signer, signer2)
import Spec.Sample.Proposal qualified as Proposal
import Spec.Util (policySucceedsWith)
import Spec.Util (policySucceedsWith, validatorSucceedsWith)
import Test.Tasty (TestTree, testGroup)
--------------------------------------------------------------------------------
@ -35,4 +52,25 @@ tests =
()
Proposal.proposalCreation
]
, testGroup
"validator"
[ validatorSucceedsWith
"stakeCreation"
(proposalValidator Proposal.proposal)
( ProposalDatum
{ proposalId = ProposalId 0
, effects =
AssocMap.fromList
[ (ResultTag 0, [])
, (ResultTag 1, [])
]
, status = Draft
, cosigners = [signer]
, thresholds = propThresholds
, votes = ProposalVotes AssocMap.empty
}
)
(Cosign [signer2])
(Proposal.cosignProposal [signer2])
]
]