Skip to main content

cobalt_test_flutter 0.5.0 copy "cobalt_test_flutter: ^0.5.0" to clipboard
cobalt_test_flutter: ^0.5.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.

0
likes
0
points
1.57k
downloads

Publisher

unverified uploader

Weekly Downloads

Widget-test helpers for Cobalt — settle a graph that is still starting, and reach the root scope of a mounted application.

Repository (GitHub)
View/report issues

Topics

#dependency-injection #di #testing #flutter

License

unknown (license)

Dependencies

cobalt_flutter, flutter, flutter_test

More

Packages that depend on cobalt_test_flutter