Skip to content

Commit

Permalink
[Infrastructure] Do not show upcoming characters on the birthday card
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Jan 1, 2022
1 parent 32caaf3 commit 8353f98
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/infrastructure/genshin_service.dart
Expand Up @@ -124,6 +124,10 @@ class GenshinServiceImpl implements GenshinService {
@override
List<CharacterFileModel> getCharactersForBirthday(DateTime date) {
return _charactersFile.characters.where((char) {
if (char.isComingSoon) {
return false;
}

if (char.birthday.isNullEmptyOrWhitespace) {
return false;
}
Expand Down
13 changes: 13 additions & 0 deletions test/infrastructure/genshin_service_test.dart
Expand Up @@ -663,6 +663,19 @@ void main() {
expect(birthday.month, equals(2));
}
});

test('upcoming characters are not shown', () async {
final service = _getService();
await service.init(AppLanguageType.english);
final localeService = _getLocaleService(AppLanguageType.english);
final upcoming = service.getUpcomingCharactersKeys();
for (final key in upcoming) {
final char = service.getCharacter(key);
final date = localeService.getCharBirthDate(char.birthday);
final chars = service.getCharactersForBirthday(date);
expect(chars.any((el) => el.key == key), false);
}
});
});

group('Elements', () {
Expand Down

0 comments on commit 8353f98

Please sign in to comment.