Pipeline fix

This commit is contained in:
2023-02-08 14:33:29 +00:00
parent 4a542a90bd
commit 87d601a62c
4 changed files with 12 additions and 18 deletions

View File

@@ -30,7 +30,7 @@ abstract class CurrencyApi {
@JsonSerializable()
class ResponseObject implements CurrencyMapper {
String base;
String last_updated;
int last_updated;
Map<String, double>? exchange_rates;
ResponseObject(this.base, this.last_updated, this.exchange_rates);

View File

@@ -15,14 +15,14 @@ mixin SafeApiCall {
Map<String, dynamic>? errorResponse = dioError.response?.data?["error"];
String error;
if (errorResponse?["error"] != null){
error = errorResponse!["error"];
if (errorResponse?["message"] != null){
error = errorResponse!["message"];
} else if (dioError.error != null){
error = dioError.error;
} else {
error = "Failed to retrieve data from api";
}
logger.e(dioError.error);
logger.e(error);
throw HttpException(error);
}

View File

@@ -1,13 +1,7 @@
{
"query": {
"count": 1
},
"results": {
"AUD_GBP": {
"id": "AUD_GBP",
"fr": "AUD",
"to": "GBP",
"val": 0.601188
}
"base": "AUD",
"last_updated": 1675689300,
"exchange_rates": {
"GBP": 0.601188
}
}

View File

@@ -108,9 +108,9 @@ void main() {
.thenAnswer((_) async => Future.error(backUpError));
// Then
expect(() async => await sut.getConversationRateFromApi(fromCurrency, toCurrency),
throwsA(predicate((e) =>
e is HttpException &&
e.message == 'Error message')));
expect(() async =>
await sut.getConversationRateFromApi(fromCurrency, toCurrency),
throwsA(predicate(
(e) => e is HttpException && e.message == 'Error message')));
});
}