Skip to content

Commit

Permalink
Remove const instance for better coverage (#375)
Browse files Browse the repository at this point in the history
Const constructors are run during the build, not at runtime, which means
using them in tests prevents code coverage from hitting constructors.

MR: const_coverage
  • Loading branch information
shyndman authored and pavanpodila committed Jan 4, 2020
1 parent b9f6a7f commit f68dc4f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion flutter_mobx/test/flutter_mobx_test.dart
Expand Up @@ -296,7 +296,9 @@ void main() {
expect(find.byType(Container), findsOneWidget);
});
testWidgets('StatefulObserverWidget can be subclassed', (tester) async {
await tester.pumpWidget(const ConstStatefulObserver());
// Ignore the lack of a `const` so that coverage hits the line
// ignore: prefer_const_constructors
await tester.pumpWidget(ConstStatefulObserver());

expect(find.byType(Container), findsOneWidget);
});
Expand Down

0 comments on commit f68dc4f

Please sign in to comment.