add new tests for creating proposals

This commit is contained in:
Hongrui Fang 2022-07-09 03:39:54 +08:00
parent 0495d27f86
commit f0d0188812
No known key found for this signature in database
GPG key ID: 1C4711FFF64C0254
11 changed files with 593 additions and 173 deletions

View file

@ -42,6 +42,8 @@ module Test.Specification (
validatorFailsWith,
effectSucceedsWith,
effectFailsWith,
testValidator,
testPolicy,
-- * Converters
toTestTree,
@ -253,3 +255,37 @@ effectFailsWith ::
ScriptContext ->
SpecificationTree
effectFailsWith tag eff datum = validatorFailsWith tag eff datum ()
testValidator ::
( PLift datum
, PlutusTx.ToData (PLifted datum)
, PLift redeemer
, PlutusTx.ToData (PLifted redeemer)
) =>
-- | Should the validator pass?
Bool ->
String ->
ClosedTerm PValidator ->
PLifted datum ->
PLifted redeemer ->
ScriptContext ->
SpecificationTree
testValidator isValid =
if isValid
then validatorSucceedsWith
else validatorFailsWith
testPolicy ::
( PLift redeemer
, PlutusTx.ToData (PLifted redeemer)
) =>
Bool ->
String ->
ClosedTerm PMintingPolicy ->
PLifted redeemer ->
ScriptContext ->
SpecificationTree
testPolicy isValid =
if isValid
then policySucceedsWith
else policyFailsWith