Vibe Coding
Tip: `mock.clock(on)` plus `await clock.settle()` lets a plugin test inspect a dispatch before it answers
The testing kit's `mock` answers the world beneath a plugin noun by noun: `mock.env(on, variables)` for `$.env`, `mock.store(on, entries)` for `$.store`, `mock.clock(on)` for `$.clock`, whose `advance(ms)` resolves every `$.clock.sleep`, `after` and `every` the plugin asked for as the clock crosses it. To see what a dispatch does mid-flight, start it unawaited, `await clock.settle()`, then assert; the clock does not move. `$.ui.press({ plugin, key })` presses a rendered Button the way a terminal click does.
Source
↳ Follow the thread