File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -22,5 +22,8 @@ void main() {
2222 expect (find.text ('Home' ), findsOneWidget);
2323 expect (find.text ('Local' ), findsOneWidget);
2424 expect (find.text ('Fedi' ), findsOneWidget);
25+
26+ // Expect to find the new status button
27+ expect (find.byIcon (Icons .create_rounded), findsOneWidget);
2528 });
2629}
Original file line number Diff line number Diff line change 1+ import 'package:flutter_test/flutter_test.dart' ;
2+
3+ import 'package:flutter/material.dart' ;
4+ import 'package:feathr/widgets/status_form.dart' ;
5+
6+ import '../utils.dart' ;
7+
8+ void main () {
9+ testWidgets (
10+ 'Status Form handles invalid data' ,
11+ (WidgetTester tester) async {
12+ await tester.pumpWidget (
13+ MaterialApp (
14+ home: Scaffold (
15+ body: Column (
16+ children: [
17+ StatusForm (
18+ apiService: getTestApiService (),
19+ onSuccessfulSubmit: (_) => {})
20+ ],
21+ ),
22+ ),
23+ ),
24+ );
25+
26+ // Initial render
27+ expect (find.byType (StatusForm ), findsOneWidget);
28+ expect (find.text ('What\' s on your mind?' ), findsOneWidget);
29+ expect (find.text ('Post' ), findsOneWidget);
30+ expect (find.text ('This field should not be empty' ), findsNothing);
31+
32+ // Attempting to post without a value
33+ await tester.tap (find.text ('Post' ));
34+ await tester.pump (const Duration (milliseconds: 100 ));
35+ expect (find.text ('This field should not be empty' ), findsOneWidget);
36+ },
37+ );
38+ }
You can’t perform that action at this time.
0 commit comments