Functions for working with time during a spec.
Suppose you use Time.every to increment a count in your model after each second.
Here's a spec you could use to describe that behavior:
Spec.describe "seconds counter"
[ Spec.scenario "some seconds pass" (
Spec.given (
Spec.Setup.init (App.init testFlags)
|> Spec.Setup.withView App.view
|> Spec.Setup.withUpdate App.update
)
|> when "some time passes"
[ Spec.Time.tick 3000
]
|> it "increments the counter" (
Spec.Observer.observeModel .seconds
|> Spec.expect (Spec.Claim.isEqual Debug.toString 3)
)
)
]Set up the scenario at a particular timezone offset.
Provide the timezone offste in minutes.
A step that simulates waiting for some number of milliseconds to pass.
Any subscriptions that depend on the passage of time will be triggered as expected.
A step that simulates waiting for the next animation frame.
Any subscriptions that depend on animation frame updates will be triggered as expected.
Set up the scenario at a particular time.
Provide the number of milliseconds since the UNIX epoch.