Clock
Index
Constructors
Methods
Constructors
constructor
Parameters
checkTime: () => Date = ...
Returns Clock
Methods
setAhead
Sets the clock ahead to force early resolution of promises returned by Clock.waitFor;
Useful for test purposes to avoid unnecessary delays.
Parameters
duration: Duration
Returns void
tick
Returns a Promise that resolves after one tick of the clock.
Useful for test purposes to avoid unnecessary delays.
Returns Promise<void>
now
Returns current time
Returns Timestamp
waitFor
Returns a Promise that will be resolved after the given duration
Parameters
duration: Duration
Returns Promise<void>
A Clock tells the time. This abstraction allows Serenity/JS to have a single place in the framework responsible for telling the time, and one that can be easily mocked for internal testing.
Learn more