Skip to content

Commit

Permalink
Fixed widget test
Browse files Browse the repository at this point in the history
  • Loading branch information
marcossevilla committed Feb 16, 2021
1 parent 55272b5 commit 04dcdd2
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions test/jokes/views/joke_page_test.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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';

Expand All @@ -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',
Expand Down Expand Up @@ -49,7 +52,7 @@ void main() {
ProviderScope(
overrides: [
jokesRepositoryProvider.overrideWithProvider(
Provider((ref) => mockRepository),
Provider((_) => mockRepository),
)
],
child: JokesApp(),
Expand Down

0 comments on commit 04dcdd2

Please sign in to comment.