Assert that a TStatebotFsm traced the route specified.
Whereas routeIsPossible only checks that a particular route can be followed, assertRoute will hook-into a machine and wait for it to trace the specified path within a timeout period.
assertRoute
import { Statebot } from 'statebot'import { assertRoute } from 'statebot/assert'let machine = Statebot(...)assertRoute( machine, 'prepare -> debounce -> sending -> done -> idle', { description: 'Email sent with no issues', fromState: 'idle', timeoutInMs: 1000 * 20, permittedDeviations: 0, logLevel: 3 }).then(() => console.log('Assertion passed!')).catch(err => console.error(`Whoops: ${err}`))machine.enter('idle')
The machine to run the assertion on.
The expected route as an arrow-delimited string:
"idle -> pending -> success -> done"
Optional
Generated using TypeDoc
Assert that a TStatebotFsm traced the route specified.
Whereas routeIsPossible only checks that a particular route can be followed,
assertRoute
will hook-into a machine and wait for it to trace the specified path within a timeout period.Returns
Example