mirror of
https://github.com/hmalik144/easy_cc_flutter.git
synced 2025-12-10 03:05:34 +00:00
Pipeline fix
This commit is contained in:
@@ -30,7 +30,7 @@ abstract class CurrencyApi {
|
|||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class ResponseObject implements CurrencyMapper {
|
class ResponseObject implements CurrencyMapper {
|
||||||
String base;
|
String base;
|
||||||
String last_updated;
|
int last_updated;
|
||||||
Map<String, double>? exchange_rates;
|
Map<String, double>? exchange_rates;
|
||||||
|
|
||||||
ResponseObject(this.base, this.last_updated, this.exchange_rates);
|
ResponseObject(this.base, this.last_updated, this.exchange_rates);
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ mixin SafeApiCall {
|
|||||||
Map<String, dynamic>? errorResponse = dioError.response?.data?["error"];
|
Map<String, dynamic>? errorResponse = dioError.response?.data?["error"];
|
||||||
String error;
|
String error;
|
||||||
|
|
||||||
if (errorResponse?["error"] != null){
|
if (errorResponse?["message"] != null){
|
||||||
error = errorResponse!["error"];
|
error = errorResponse!["message"];
|
||||||
} else if (dioError.error != null){
|
} else if (dioError.error != null){
|
||||||
error = dioError.error;
|
error = dioError.error;
|
||||||
} else {
|
} else {
|
||||||
error = "Failed to retrieve data from api";
|
error = "Failed to retrieve data from api";
|
||||||
}
|
}
|
||||||
logger.e(dioError.error);
|
logger.e(error);
|
||||||
|
|
||||||
throw HttpException(error);
|
throw HttpException(error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
{
|
{
|
||||||
"query": {
|
"base": "AUD",
|
||||||
"count": 1
|
"last_updated": 1675689300,
|
||||||
},
|
"exchange_rates": {
|
||||||
"results": {
|
"GBP": 0.601188
|
||||||
"AUD_GBP": {
|
|
||||||
"id": "AUD_GBP",
|
|
||||||
"fr": "AUD",
|
|
||||||
"to": "GBP",
|
|
||||||
"val": 0.601188
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,9 +108,9 @@ void main() {
|
|||||||
.thenAnswer((_) async => Future.error(backUpError));
|
.thenAnswer((_) async => Future.error(backUpError));
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
expect(() async => await sut.getConversationRateFromApi(fromCurrency, toCurrency),
|
expect(() async =>
|
||||||
throwsA(predicate((e) =>
|
await sut.getConversationRateFromApi(fromCurrency, toCurrency),
|
||||||
e is HttpException &&
|
throwsA(predicate(
|
||||||
e.message == 'Error message')));
|
(e) => e is HttpException && e.message == 'Error message')));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user