add new tests for creating proposals
This commit is contained in:
parent
5eee3127b2
commit
79eb0772c3
11 changed files with 593 additions and 173 deletions
|
|
@ -1,13 +1,6 @@
|
|||
module Sample.Proposal.Shared (proposalTxRef, stakeTxRef, testFunc) where
|
||||
module Sample.Proposal.Shared (proposalTxRef, stakeTxRef) where
|
||||
|
||||
import Plutarch.Api.V1 (PValidator)
|
||||
import Plutarch.Lift (PUnsafeLiftDecl (..))
|
||||
import PlutusLedgerApi.V1 (ScriptContext, ToData, TxId)
|
||||
import Test.Specification (
|
||||
SpecificationTree,
|
||||
validatorFailsWith,
|
||||
validatorSucceedsWith,
|
||||
)
|
||||
import PlutusLedgerApi.V1 (TxId)
|
||||
|
||||
-- | 'TxId' of all the propsoal inputs in the samples.
|
||||
proposalTxRef :: TxId
|
||||
|
|
@ -16,24 +9,3 @@ proposalTxRef = "0b2086cbf8b6900f8cb65e012de4516cb66b5cb08a9aaba12a8b88be"
|
|||
-- | 'TxId' of all the stake inputs in the samples.
|
||||
stakeTxRef :: TxId
|
||||
stakeTxRef = "0ca36f3a357bc69579ab2531aecd1e7d3714d993c7820f40b864be15"
|
||||
|
||||
-- | Get the test function given whether a test case is valid.
|
||||
testFunc ::
|
||||
forall {datum :: PType} {redeemer :: PType}.
|
||||
( PUnsafeLiftDecl datum
|
||||
, PUnsafeLiftDecl redeemer
|
||||
, ToData (PLifted datum)
|
||||
, ToData (PLifted redeemer)
|
||||
) =>
|
||||
-- | Should the validator pass?
|
||||
Bool ->
|
||||
String ->
|
||||
ClosedTerm PValidator ->
|
||||
PLifted datum ->
|
||||
PLifted redeemer ->
|
||||
ScriptContext ->
|
||||
SpecificationTree
|
||||
testFunc isValid =
|
||||
if isValid
|
||||
then validatorSucceedsWith
|
||||
else validatorFailsWith
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue