Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Created September 9, 2025 08:32
Show Gist options
  • Select an option

  • Save YonatanKra/6042e6fecfbb54df7b21e8a655ebe170 to your computer and use it in GitHub Desktop.

Select an option

Save YonatanKra/6042e6fecfbb54df7b21e8a655ebe170 to your computer and use it in GitHub Desktop.
testWidgets('should display a WordPair and update on button press', (WidgetTester tester) async {
await tester.pumpWidget(
ChangeNotifierProvider(
create: (context) => MyAppState(),
child: MaterialApp(home: MyHomePage()),
),
);
// Verify initial WordPair is displayed
expect(find.textContaining('_'), findsOneWidget);
// Tap the 'Next' button
await tester.tap(find.text('Next'));
await tester.pump();
// Verify the WordPair has changed
expect(find.textContaining('_'), findsOneWidget);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment