v1.0.15 AppText

This commit is contained in:
Tibor Bossanyi
2023-03-19 09:51:05 +01:00
parent cfafdc8994
commit f2f70a6db9
5 changed files with 149 additions and 3 deletions
+115
View File
@@ -0,0 +1,115 @@
import 'dart:convert';
import 'package:flutter_test/flutter_test.dart';
import 'package:workouttest_util/model/app_text.dart';
main() {
late String appTextJson;
setUp(() {
appTextJson = '''
[
{
"textId": 1,
"textKey": "monday",
"screenshotUrl": null,
"checked": false,
"translations": [
{
"translationId": 1,
"languageCode": "hu",
"translation": "hétfő"
}
]
},
{
"textId": 2,
"textKey": "tuesday",
"screenshotUrl": null,
"checked": false,
"translations": [
{
"translationId": 2,
"languageCode": "hu",
"translation": "kedd"
}
]
},
{
"textId": 3,
"textKey": "wednesday",
"screenshotUrl": null,
"checked": false,
"translations": [
{
"translationId": 3,
"languageCode": "hu",
"translation": "szerda"
}
]
},
{
"textId": 4,
"textKey": "thursday",
"screenshotUrl": null,
"checked": false,
"translations": [
{
"translationId": 4,
"languageCode": "hu",
"translation": "csütörtök"
}
]
},
{
"textId": 5,
"textKey": "friday",
"screenshotUrl": null,
"checked": false,
"translations": [
{
"translationId": 5,
"languageCode": "hu",
"translation": "péntek"
}
]
},
{
"textId": 6,
"textKey": "saturday",
"screenshotUrl": null,
"checked": false,
"translations": [
{
"translationId": 6,
"languageCode": "hu",
"translation": "szombat"
}
]
},
{
"textId": 7,
"textKey": "sunday",
"screenshotUrl": null,
"checked": false,
"translations": [
{
"translationId": 7,
"languageCode": "hu",
"translation": "vasárnap"
}
]
}
]
''';
});
group('customer', () {
test('decode from json successful', () async {
Iterable json = jsonDecode(appTextJson);
final List<AppText> appTexts = json.map((text) => AppText.fromJson(text)).toList();
expect(appTexts[0].textKey, "monday");
expect(appTexts[1].translations['hu'], "kedd");
print(appTexts[0]);
});
});
}
-2
View File
@@ -5,8 +5,6 @@ import 'package:workouttest_util/model/cache.dart';
import 'package:workouttest_util/model/customer.dart';
import 'package:workouttest_util/model/property.dart';
import 'package:workouttest_util/repository/customer_repository.dart';
import 'dart:collection';
import 'package:intl/intl.dart';
main() {
setUp(() {