cobalt_test_flutter 0.6.0
cobalt_test_flutter: ^0.6.0 copied to clipboard
Widget-test helpers for Cobalt — settle a graph that is still starting, and reach the root scope of a mounted application.
example/example.md
cobalt_test_flutter example #
import 'package:cobalt_test_flutter/cobalt_test_flutter.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('the screen resolves what the graph registered', (tester) async {
await tester.pumpWidget(const MyApp());
// Not pumpAndSettle: the loading indicator schedules frames forever.
await settle(tester);
final app = mountedRootScope(tester);
expect(app.isRegistered<NoteStore>(), isTrue);
expect(find.text('0 notes'), findsOneWidget);
});
}
A screen that owns a scope publishes a provider of its own, so mountedRootScope climbs past it —
what it returns is the application's graph, not the screen's.