This page gives reference information on scenario syntax, used for testing templates:
For an introduction to scenarios, see Testing DAML using scenarios.
scenariofunction. Introduces a series of transactions to be submitted to the ledger.
- Submits an action (a create or an exercise) to the ledger.
- Takes two arguments, the party submitting followed by the expression, for example:
submit bankOfEngland do create ...
submit, but you’re asserting it should fail.
- Takes two arguments, the party submitting followed by the expression by a party, for example:
submitMustFail bankOfEngland do create ...
In a scenario, you may want time to pass so you can test something properly. You can do this with
Here’s an example of passing time:
timeTravel = scenario do -- Get current ledger effective time t1 <- getTime assert (t1 == datetime 1970 Jan 1 0 0 0) -- Pass 1 day pass (days 1) -- Get new ledger effective time t2 <- getTime assert (t2 == datetime 1970 Jan 2 0 0 0)