@modoki/engine / index / TestWorld
Interface: TestWorld
Testing Harness
dispatch
dispatch: (
name,payload?) =>TestWorld
Fire a named action/intent (same path a UI button would). Chainable.
Parameters
name
string
payload?
Returns
TestWorld
dispose
dispose: () =>
void
Tear down ALL global state and destroy the world. Call in afterEach.
Returns
void
events
events: (
filter?) =>GameEvent[]
Read the event journal, optionally filtered by type.
Parameters
filter?
type?
string
Returns
query
query: (...
traits) =>QueryResult<QueryParameter[]>
Query the world (passthrough to world.query).
Parameters
traits
...unknown[]
Returns
QueryResult<QueryParameter[]>
setTimeScale
setTimeScale: (
scale) =>TestWorld
Set the global time scale (0 = pause/time-stop, 0.3 = slow-mo). Chainable.
Parameters
scale
number
Returns
TestWorld
spawn
spawn: (...
traits) =>Entity
Spawn an entity (passthrough to world.spawn).
Parameters
traits
...unknown[]
Returns
Entity
step
step: (
ticks?,dt?) =>TestWorld
Advance ticks fixed-dt frames deterministically. Chainable.
Parameters
ticks?
number
dt?
number
Returns
TestWorld
trait
trait: <
T>(t,entity) =>T
Read a trait off an entity.
Type Parameters
T
T
Parameters
t
unknown
entity
unknown
Returns
T
world
readonlyworld:World
The underlying koota world (also the current world for the harness lifetime).