Skip to content

Commit 762e860

Browse files
committed
test(app_service): statuscode != 200
1 parent 783feef commit 762e860

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/src/services/app_service_test.dart

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ main() {
2020
expect(actualResponse, equals(expectedResponse));
2121
});
2222

23-
//TODO 1- Must test the case status != 200
23+
test('status != 200', () async {
24+
final mockClient = MockClient((request) async {
25+
return Response(json.encode(exampleJsonResponse), 500);
26+
});
27+
final service = AppService(mockClient);
28+
expect(
29+
() async => await service.loadMovies(),
30+
throwsA(predicate((e) =>
31+
e is LoadMoviesException &&
32+
e.message == 'LoadMovies - Request Error: 500')),
33+
);
34+
});
2435
});
2536
}

0 commit comments

Comments
 (0)