Skip to content

Commit

Permalink
increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbuechler committed Aug 25, 2023
1 parent 25618d8 commit e1790ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/src/adapters/dio_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class DioAdapter with Recording, RequestHandling implements HttpClientAdapter {
Future? cancelFuture,
) async {
if (_isClosed) {
logger.e('Cannot establish connection after [$runtimeType] got closed!');
throw ClosedException(
'Cannot establish connection after [$runtimeType] got closed!',
);
Expand Down
6 changes: 4 additions & 2 deletions test/adapters/dio_adapter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ void main() {

expect(
() async => await dio.get('/route'),
throwsA(predicate(
(DioException dioError) => dioError.error is ClosedException)),
throwsA(predicate((DioException dioError) =>
dioError.error is ClosedException &&
dioError.error.toString() ==
'ClosedException: Cannot establish connection after [DioAdapter] got closed!')),
);
});

Expand Down

0 comments on commit e1790ad

Please sign in to comment.