Testing
A Kerros Provider is an ordinary React component. Render a new Provider in each test to get isolated state without resetting a global Store.
This example uses Vitest and Testing Library.
Prepare the test component
Test an update
The next test mounts a new CounterProvider, so count starts at 0 again.
Test Provider props
Provider props are passed to the Store Hook and can be tested with rerender:
Test the missing Provider error
Public Store packages should verify the Provider boundary:
Test selector isolation
Only count renders when subscription behavior itself is under test. Create selected and ignored fields, subscribe to one, and update the other:
When the selector's top-level field references stay equal, updating ignored must not rerender the selected consumer.
Reusable Store packages should also cover Strict Mode, consumer unmounting, server rendering, and multiple Provider instances.