Reference
@reckona/mreact-test-utils
16 public exports.
Function
Functionact
function act<T>(fn: (): T | Promise<T>): Promise<T>Runs a test action and flushes reactive effects after it settles.FunctioncreateAppFixturefunction createAppFixture(prefix: string): Promise<AppFixture>Creates a temporary app fixture directory for integration tests.FunctioncreateCellMockfunction createCellMock<T>(initial: T): Cell<T>Creates a real reactive cell for tests that need controllable state.FunctioncreateComputedMockfunction createComputedMock<T>(fn: (): T): ReadonlyCell<T>Creates a real computed reactive value for tests.FunctionflushReactivefunction flushReactive(): Promise<void>Flushes queued reactive effects for tests.FunctioninvokeRouteHandlerfunction invokeRouteHandler<TContext>(handler: RouteHandler<TContext>, request: Request, context?: TContext): Promise<Response>Invokes a route handler and normalizes redirect, not-found, and invalid responses.FunctionreadQueryStatefunction readQueryState(html: string): DehydratedQueryState | undefinedReads dehydrated query state from rendered HTML.Functionrenderfunction render(value: ComponentRenderInput, options: ComponentRenderOptions): ComponentRenderResultRenders a reactive component value into a DOM container for tests.FunctionresponseTextfunction responseText(response: Response): Promise<string>Reads a response body as text.Interface
InterfaceAppFixture
interface AppFixtureTemporary app fixture for rendering and writing app-router files in tests.InterfaceComponentRenderOptionsinterface ComponentRenderOptionsOptions for mounting a component render in tests.InterfaceComponentRenderResultinterface ComponentRenderResultResult returned by the component render helper.InterfaceDehydratedQueryStateinterface DehydratedQueryStateQuery state decoded from an SSR hydration script.Type Alias
Type AliasAppFixtureRenderOptions
type AppFixtureRenderOptions = Omit<RenderAppRequestOptions, "appDir" | "request"> & { origin?: string; request?: RequestInit }Options passed when rendering a request with an app fixture.Type AliasComponentRenderInputtype ComponentRenderInput = RenderValue | (): RenderValueComponent render input accepted by render and rerender.Type AliasRouteHandlertype RouteHandler = (request: Request, context: TContext): Response | Promise<Response>Route handler signature accepted by invokeRouteHandler.