[**Documentation**](../../../README)

***

[Documentation](../../../README) / [@zerotal/flow](../README) / 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](classes/FlowTest#mount), which returns a chainable [FlowTest](classes/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

```ts
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');
```

```ts
const t = await FlowTest.mount(CreatePostPage);
await t.call('save');
t.assertHasErrors('title');
t.assertSee('The title field is required.');
```

## Classes

- [FlowTest](classes/FlowTest)

## Functions

- [hydrate](functions/hydrate)
