simple tests for setting delegate

This commit is contained in:
Hongrui Fang 2022-07-25 22:07:27 +08:00
parent 8fba8e1598
commit 11757be255
5 changed files with 238 additions and 1 deletions

View file

@ -15,6 +15,7 @@ import Agora.Stake (
StakeRedeemer (DepositWithdraw),
)
import Agora.Stake.Scripts (stakePolicy, stakeValidator)
import Data.Bool (Bool (..))
import Data.Maybe (Maybe (..))
import Sample.Stake (
DepositWithdrawExample (
@ -31,6 +32,7 @@ import Sample.Stake qualified as Stake (
stakeCreationWrongDatum,
stakeDepositWithdraw,
)
import Sample.Stake.SetDelegate qualified as SetDelegate
import Test.Specification (
SpecificationTree,
group,
@ -83,5 +85,32 @@ specs =
(toDatum $ StakeDatum 100_000 signer Nothing [])
(toDatum $ DepositWithdraw 1_000_000)
(Stake.stakeDepositWithdraw $ DepositWithdrawExample {startAmount = 100_000, delta = negate 1_000_000})
, group
"set delegate"
[ SetDelegate.mkTestCase
"override existing delegate"
SetDelegate.overrideExistingDelegateParameters
True
, SetDelegate.mkTestCase
"remove existing delegate"
SetDelegate.clearDelegateParameters
True
, SetDelegate.mkTestCase
"set delegate to something"
SetDelegate.setDelegateParameters
True
, SetDelegate.mkTestCase
"owner doesn't sign the transaction"
SetDelegate.ownerDoesntSignParameters
False
, SetDelegate.mkTestCase
"delegate to the owner"
SetDelegate.delegateToOwnerParameters
False
, SetDelegate.mkTestCase
"invalid output stake"
SetDelegate.invalidOutputStakeDatumParameters
False
]
]
]