File tree Expand file tree Collapse file tree 1 file changed +37
-2
lines changed Expand file tree Collapse file tree 1 file changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,48 @@ main() {
23
23
test ('close does not emit new app state' , () {
24
24
appBloc.close ();
25
25
26
- //TODO: 1- Must implement and check emitsDone
27
- throw UnimplementedError ();
26
+ expectLater (
27
+ appBloc,
28
+ emitsInOrder ([AppEmpty (), emitsDone]),
29
+ );
28
30
});
29
31
30
32
group ('AppState' , () {
31
33
test ('AppEmpty : initialState' , () {
32
34
expect (appBloc.initialState, AppEmpty ());
33
35
});
36
+
37
+ test ('AppError' , () {
38
+ when (serviceMock.loadMovies ()).thenThrow (Error );
39
+
40
+ final expectedResponse = [
41
+ AppEmpty (),
42
+ AppLoading (),
43
+ AppError (),
44
+ ];
45
+
46
+ appBloc.add (FetchEvent ());
47
+
48
+ expectLater (
49
+ appBloc,
50
+ emitsInOrder (expectedResponse),
51
+ );
52
+ });
53
+
54
+ test ('AppLoaded' , () {
55
+ when (serviceMock.loadMovies ()).thenAnswer ((_) => Future .value (response));
56
+ final expectedResponse = [
57
+ AppEmpty (),
58
+ AppLoading (),
59
+ AppLoaded (response: response),
60
+ ];
61
+
62
+ appBloc.add (FetchEvent ());
63
+
64
+ expectLater (
65
+ appBloc,
66
+ emitsInOrder (expectedResponse),
67
+ );
68
+ });
34
69
});
35
70
}
You can’t perform that action at this time.
0 commit comments