Skip to main content
zerotal

Documentation


Documentation / @zerotal/flow / testing

testing

@zerotal/flow/testing — in-process test helpers for Flow components.

Runs the full server-side Flow request pipeline in-process for Bun's test runner: no WebSocket connection is opened — actions are dispatched directly against a mounted page instance, driving its real lifecycle hooks (boot/mount/hydrate/update). The entry point is FlowTest.mount, which returns a chainable FlowTest exposing state-driving actions (set/update/call) and fluent assertions (assertSee, assertRedirectedTo, assertHasErrors, assertFlashed, …). hydrate is re-exported for advanced snapshot-level tests.

Examples

import { FlowTest } from '@zerotal/flow/testing';

const t = await FlowTest.mount(LoginPage);
await t.set('email', 'test@example.com');
await t.set('password', 'secret');
await t.call('login');
t.assertRedirectedTo('/dashboard');
const t = await FlowTest.mount(CreatePostPage);
await t.call('save');
t.assertHasErrors('title');
t.assertSee('The title field is required.');

Classes

Functions