test_utils library
Test utilities for code built on top of armature.
Usage from a test file:
import 'package:armature/test_utils.dart';
void main() {
test('my feature works', () async {
final container = await startedContainer(features: [myFeature]);
final store = myFeature.storeOf<MyStore>(container);
// ...
});
}
This sub-library pulls in package:test — import it only from test
code. Production code must not reach for these helpers.
Extensions
-
FeatureTestExtensions
on Feature<
TStores, TExports, TPorts> -
Test-scoped extensions on Feature. Only available when
package:armature/test_utils.dartis imported.
Functions
-
collectErrors(
{int? maxResolveConcurrency}) → ErrorCollector - Creates a pre-wired error collector.
-
noopErrorHandler(
{required String source, required ArmatureError error, required Map< String, String> meta}) → void - Error handler that swallows every error. Use in tests where the recoverable-error path isn't the subject under test.
-
silentOptions(
{int? maxResolveConcurrency}) → ContainerOptions - Convenience builder for ContainerOptions with noopErrorHandler and no logger.
-
startedContainer(
{required List< AnyFeature> features, ContainerOptions? options, Logger? logger}) → Future<AppContainer> -
Spins up an AppContainer, registers disposal via
addTearDown, and awaitsstart(). Returns the ready-to-use container.
Typedefs
-
ErrorCollector
= ({List<
ArmatureError> errors, ContainerOptions options}) -
Paired result from collectErrors: a ContainerOptions whose
errorHandlerappends every error intoerrors.