Merge remote-tracking branch 'origin/develop' into feat/offline-connect
This commit is contained in:
@@ -60,7 +60,7 @@ void main() {
|
||||
expect(error.message, message);
|
||||
});
|
||||
|
||||
test('.fromDioError', () {
|
||||
test('.fromDioException', () {
|
||||
const code = 333;
|
||||
const statusCode = 666;
|
||||
const message = 'test-error-message';
|
||||
@@ -69,7 +69,7 @@ void main() {
|
||||
..code = code
|
||||
..statusCode = statusCode
|
||||
..message = message;
|
||||
final dioError = DioError(
|
||||
final dioError = DioException(
|
||||
requestOptions: options,
|
||||
response: Response(
|
||||
requestOptions: options,
|
||||
@@ -77,7 +77,7 @@ void main() {
|
||||
data: data.toJson(),
|
||||
),
|
||||
);
|
||||
final error = StreamChatNetworkError.fromDioError(dioError);
|
||||
final error = StreamChatNetworkError.fromDioException(dioError);
|
||||
expect(error, isNotNull);
|
||||
expect(error.code, code);
|
||||
expect(error.message, message);
|
||||
|
||||
@@ -88,7 +88,7 @@ void main() {
|
||||
requestOptions: options,
|
||||
data: errorResponse.toJson(),
|
||||
);
|
||||
final err = DioError(requestOptions: options, response: response);
|
||||
final err = DioException(requestOptions: options, response: response);
|
||||
final handler = ErrorInterceptorHandler();
|
||||
|
||||
when(() => tokenManager.isStatic).thenReturn(false);
|
||||
@@ -135,7 +135,7 @@ void main() {
|
||||
requestOptions: options,
|
||||
data: errorResponse.toJson(),
|
||||
);
|
||||
final err = DioError(requestOptions: options, response: response);
|
||||
final err = DioException(requestOptions: options, response: response);
|
||||
final handler = ErrorInterceptorHandler();
|
||||
|
||||
when(() => tokenManager.isStatic).thenReturn(false);
|
||||
@@ -153,7 +153,7 @@ void main() {
|
||||
} catch (e) {
|
||||
// need to cast it as the type is private in dio
|
||||
final error = (e as dynamic).data;
|
||||
expect(error, isA<DioError>());
|
||||
expect(error, isA<DioException>());
|
||||
}
|
||||
|
||||
verify(() => tokenManager.isStatic).called(1);
|
||||
@@ -179,7 +179,7 @@ void main() {
|
||||
requestOptions: options,
|
||||
data: errorResponse.toJson(),
|
||||
);
|
||||
final err = DioError(requestOptions: options, response: response);
|
||||
final err = DioException(requestOptions: options, response: response);
|
||||
final handler = ErrorInterceptorHandler();
|
||||
|
||||
when(() => tokenManager.isStatic).thenReturn(true);
|
||||
@@ -191,8 +191,8 @@ void main() {
|
||||
} catch (e) {
|
||||
// need to cast it as the type is private in dio
|
||||
final error = (e as dynamic).data;
|
||||
expect(error, isA<DioError>());
|
||||
final response = StreamChatNetworkError.fromDioError(error);
|
||||
expect(error, isA<DioException>());
|
||||
final response = StreamChatNetworkError.fromDioException(error);
|
||||
expect(response.errorCode, code);
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ void main() {
|
||||
const path = 'test-request-path';
|
||||
final options = RequestOptions(path: path);
|
||||
final response = Response(requestOptions: options);
|
||||
final err = DioError(requestOptions: options, response: response);
|
||||
final err = DioException(requestOptions: options, response: response);
|
||||
final handler = ErrorInterceptorHandler();
|
||||
|
||||
authInterceptor.onError(err, handler);
|
||||
@@ -217,7 +217,7 @@ void main() {
|
||||
} catch (e) {
|
||||
// need to cast it as the type is private in dio
|
||||
final error = (e as dynamic).data;
|
||||
expect(error, isA<DioError>());
|
||||
expect(error, isA<DioException>());
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ void main() {
|
||||
requestOptions: options,
|
||||
);
|
||||
|
||||
expect(dioError, isA<DioError>());
|
||||
expect(dioError, isA<DioException>());
|
||||
expect(dioError, isNotNull);
|
||||
expect(dioError.error, error);
|
||||
expect(dioError.requestOptions, options);
|
||||
|
||||
@@ -21,7 +21,7 @@ void main() {
|
||||
statusCode: 200,
|
||||
);
|
||||
|
||||
DioError throwableError(
|
||||
DioException throwableError(
|
||||
String path, {
|
||||
StreamChatNetworkError? error,
|
||||
bool streamChatDioError = false,
|
||||
@@ -32,11 +32,11 @@ void main() {
|
||||
..code = error?.code
|
||||
..statusCode = error?.statusCode
|
||||
..message = error?.message;
|
||||
DioError? dioError;
|
||||
DioException? dioError;
|
||||
if (streamChatDioError) {
|
||||
dioError = StreamChatDioError(error: error!, requestOptions: options);
|
||||
} else {
|
||||
dioError = DioError(
|
||||
dioError = DioException(
|
||||
error: error,
|
||||
requestOptions: options,
|
||||
response: Response(
|
||||
@@ -210,7 +210,7 @@ void main() {
|
||||
await client.get(path);
|
||||
} catch (e) {
|
||||
expect(e, isA<StreamChatNetworkError>());
|
||||
expect(e, StreamChatNetworkError.fromDioError(error));
|
||||
expect(e, StreamChatNetworkError.fromDioException(error));
|
||||
}
|
||||
|
||||
verify(() => dio.get(
|
||||
@@ -263,7 +263,7 @@ void main() {
|
||||
await client.post(path);
|
||||
} catch (e) {
|
||||
expect(e, isA<StreamChatNetworkError>());
|
||||
expect(e, StreamChatNetworkError.fromDioError(error));
|
||||
expect(e, StreamChatNetworkError.fromDioException(error));
|
||||
}
|
||||
|
||||
verify(() => dio.post(
|
||||
@@ -317,7 +317,7 @@ void main() {
|
||||
await client.delete(path);
|
||||
} catch (e) {
|
||||
expect(e, isA<StreamChatNetworkError>());
|
||||
expect(e, StreamChatNetworkError.fromDioError(error));
|
||||
expect(e, StreamChatNetworkError.fromDioException(error));
|
||||
}
|
||||
|
||||
verify(() => dio.delete(
|
||||
@@ -371,7 +371,7 @@ void main() {
|
||||
await client.patch(path);
|
||||
} catch (e) {
|
||||
expect(e, isA<StreamChatNetworkError>());
|
||||
expect(e, StreamChatNetworkError.fromDioError(error));
|
||||
expect(e, StreamChatNetworkError.fromDioException(error));
|
||||
}
|
||||
|
||||
verify(() => dio.patch(
|
||||
@@ -425,7 +425,7 @@ void main() {
|
||||
await client.put(path);
|
||||
} catch (e) {
|
||||
expect(e, isA<StreamChatNetworkError>());
|
||||
expect(e, StreamChatNetworkError.fromDioError(error));
|
||||
expect(e, StreamChatNetworkError.fromDioException(error));
|
||||
}
|
||||
|
||||
verify(() => dio.put(
|
||||
@@ -486,7 +486,7 @@ void main() {
|
||||
await client.postFile(path, file);
|
||||
} catch (e) {
|
||||
expect(e, isA<StreamChatNetworkError>());
|
||||
expect(e, StreamChatNetworkError.fromDioError(error));
|
||||
expect(e, StreamChatNetworkError.fromDioException(error));
|
||||
}
|
||||
|
||||
verify(() => dio.post(
|
||||
|
||||
Reference in New Issue
Block a user