shard_test library
Public testing utilities for the shard package.
Import from your test code:
import 'package:shard/shard_test.dart';
This entry point is intentionally separate from package:shard/shard.dart
so production builds do not link the test utilities. Nothing in
lib/shard.dart's import graph imports this file.
Classes
- FakeCacheService
- An in-memory CacheService implementation for use in tests.
- FakeStateStorage
- An in-memory StateStorage implementation for use in tests.
- MockShardObserver
- A ShardObserver that records all events for inspection in tests.
-
ObservedChange<
T> -
A single observed
onChangeevent captured by MockShardObserver. - ObservedError
-
A single observed
onErrorevent captured by MockShardObserver. -
ShardTester<
T> - A helper for testing Shard subclasses by capturing emissions, waiting for specific states, and asserting state sequences.
Functions
- A thin declarative wrapper around ShardTester.
Exceptions / Errors
- ShardAssertionError
- Thrown by ShardTester when an assertion fails.
- ShardTimeoutError
- Thrown by ShardTester when an async wait exceeds its timeout.