From 04dcdd2ef40125f76e6bb0938c60fd703e2a9780 Mon Sep 17 00:00:00 2001 From: Marcos Sevilla Date: Tue, 16 Feb 2021 15:30:08 -0600 Subject: [PATCH] Fixed widget test --- test/jokes/views/joke_page_test.dart | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/test/jokes/views/joke_page_test.dart b/test/jokes/views/joke_page_test.dart index e287b4b..272384d 100644 --- a/test/jokes/views/joke_page_test.dart +++ b/test/jokes/views/joke_page_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter_jokes/src/features/jokes/logic/jokes_provider.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:dartz/dartz.dart'; @@ -8,6 +7,7 @@ import 'package:errors/errors.dart'; import 'package:jokes/jokes.dart'; import 'package:flutter_jokes/src/app.dart'; +import 'package:flutter_jokes/src/features/jokes/logic/jokes_provider.dart'; import 'package:flutter_jokes/src/features/jokes/views/joke_page.dart'; import 'package:flutter_jokes/src/features/jokes/views/joke_page.i18n.dart'; @@ -16,12 +16,15 @@ class MockRepository extends Mock implements IJokesRepository {} void main() { final getJokeButton = find.byKey(getJokeButtonKey); - testWidgets('Render default get joke message', (tester) async { - // Setup - await tester.pumpWidget(ProviderScope(child: JokesApp())); - // Expect - expect(find.text('${kTellJokeMessage.i18n}'), findsWidgets); - }); + testWidgets( + 'Render default get joke message', + (tester) async { + // Setup + await tester.pumpWidget(ProviderScope(child: JokesApp())); + // Expect + expect(find.text('${kTellJokeMessage.i18n}'), findsWidgets); + }, + ); testWidgets( 'Press button to get a joke', @@ -49,7 +52,7 @@ void main() { ProviderScope( overrides: [ jokesRepositoryProvider.overrideWithProvider( - Provider((ref) => mockRepository), + Provider((_) => mockRepository), ) ], child: JokesApp(),