File tree Expand file tree Collapse file tree 2 files changed +79
-0
lines changed Expand file tree Collapse file tree 2 files changed +79
-0
lines changed Original file line number Diff line number Diff line change @@ -87,4 +87,42 @@ final exampleJsonResponse = {
87
87
"vote_count" : 3439
88
88
}
89
89
],
90
+ };
91
+
92
+ ///
93
+ /// Another Example JSON Response from the API : https://developers.themoviedb.org/3
94
+ ///
95
+ final exampleJsonResponse2 = {
96
+ "results" : [
97
+ {
98
+ "adult" : false ,
99
+ "backdrop_path" : "/fCayJrkfRaCRCTh8GqN30f8oyQF.jpg" ,
100
+ "homepage" : "" ,
101
+ "id" : 1 ,
102
+ "original_language" : "en" ,
103
+ "original_title" : "Fight Club" ,
104
+ "poster_path" : null ,
105
+ "release_date" : "1999-10-12" ,
106
+ "title" : "Fight Club" ,
107
+ "overview" : "Overview 1" ,
108
+ "video" : false ,
109
+ "vote_average" : 7.8 ,
110
+ "vote_count" : 3439
111
+ },
112
+ {
113
+ "adult" : false ,
114
+ "backdrop_path" : "/fCayJrkfRaCECTh8GqN30f8oyQF.jpg" ,
115
+ "homepage" : "" ,
116
+ "id" : 2 ,
117
+ "original_language" : "en" ,
118
+ "original_title" : "London the best" ,
119
+ "poster_path" : null ,
120
+ "release_date" : "1999-10-12" ,
121
+ "title" : "Fight Club" ,
122
+ "overview" : "Overview 2" ,
123
+ "video" : false ,
124
+ "vote_average" : 8.8 ,
125
+ "vote_count" : 3440
126
+ }
127
+ ],
90
128
};
Original file line number Diff line number Diff line change
1
+ import 'package:flutter/material.dart' ;
2
+ import 'package:flutter_movie_deep_dive_test/src/models/models.dart' ;
3
+ import 'package:flutter_movie_deep_dive_test/src/widgets/widgets.dart' ;
4
+ import 'package:flutter_test/flutter_test.dart' ;
5
+ import 'package:image_test_utils/image_test_utils.dart' ;
6
+
7
+ import '../common.dart' ;
8
+
9
+ void main () {
10
+ MoviesResponse exampleResponse;
11
+
12
+ setUp (() {
13
+ exampleResponse = MoviesResponse .fromJson (exampleJsonResponse2);
14
+ });
15
+
16
+ testWidgets ('Display Movies List' , (WidgetTester tester) async {
17
+ provideMockedNetworkImages (() async {
18
+ await tester.pumpWidget (
19
+ MaterialApp (
20
+ home: Scaffold (
21
+ body: MoviesList (
22
+ response: exampleResponse,
23
+ ),
24
+ ),
25
+ ),
26
+ );
27
+
28
+ Finder movieFinder = find.byType (MovieCard );
29
+ //TODO 1- Fix this following except method
30
+ expect (movieFinder, findsNWidgets (1 ));
31
+
32
+ // Expect movie card from exampleJson
33
+ movieFinder = find.byKey (Key ("1" ));
34
+ expect (movieFinder, findsOneWidget);
35
+
36
+ //TODO 1- Fix the following find.byKey
37
+ movieFinder = find.byKey (Key ("4" ));
38
+ expect (movieFinder, findsOneWidget);
39
+ });
40
+ });
41
+ }
You can’t perform that action at this time.
0 commit comments