From 55a90c99bdb97b1f014d9cdce4a09d02d1ef4627 Mon Sep 17 00:00:00 2001 From: Jaime Sanchez Date: Wed, 5 Jun 2024 17:47:55 +0200 Subject: [PATCH] refactor: rename Mascots enum to Mascot --- .../lib/src/crossword_repository.dart | 2 +- .../test/src/crossword_repository_test.dart | 19 +++--- .../game_domain/lib/src/models/mascots.dart | 2 +- .../game_domain/lib/src/models/player.dart | 6 +- .../game_domain/lib/src/models/player.g.dart | 14 ++--- .../game_domain/lib/src/models/word.dart | 4 +- .../game_domain/lib/src/models/word.g.dart | 14 ++--- .../test/src/models/board_section_test.dart | 4 +- .../test/src/models/player_test.dart | 28 ++++----- .../test/src/models/word_test.dart | 4 +- .../test/src/leaderboard_repository_test.dart | 6 +- api/test/routes/game/answer_test.dart | 20 +++---- lib/app/view/app.dart | 12 ++-- lib/crossword/view/crossword_board_view.dart | 19 +++--- lib/crossword/view/crossword_page.dart | 2 +- lib/crossword/widgets/crossword_letter.dart | 12 ++-- lib/end_game/view/end_game_view_content.dart | 8 +-- lib/extensions/mascot_color.dart | 10 ++-- lib/how_to_play/cubit/how_to_play_cubit.dart | 2 +- .../widgets/how_to_play_content.dart | 2 +- lib/leaderboard/bloc/leaderboard_bloc.dart | 2 +- lib/leaderboard/view/leaderboard_success.dart | 8 +-- lib/player/bloc/player_event.dart | 2 +- lib/player/bloc/player_state.dart | 6 +- lib/share/widgets/share_image.dart | 8 +-- .../cubit/team_selection_cubit.dart | 8 +-- .../view/team_selection_page.dart | 58 +++++++++---------- .../widgets/team_selection_mascot.dart | 2 +- .../team_selection_mascot_platform.dart | 2 +- .../widgets/word_selection_top_bar.dart | 2 +- .../src/resources/leaderboard_resource.dart | 2 +- .../resources/leaderboard_resource_test.dart | 4 +- .../test/src/leaderboard_repository_test.dart | 16 ++--- test/app/view/app_test.dart | 8 +-- .../view/crossword_board_view_test.dart | 18 +++--- test/crossword/view/crossword_page_test.dart | 16 ++--- .../widgets/crossword_letter_test.dart | 20 +++---- .../view/end_game_view_content_test.dart | 16 ++--- test/extensions/mascot_color_test.dart | 10 ++-- .../cubit/how_to_play_cubit_test.dart | 4 +- .../view/how_to_play_page_test.dart | 8 +-- .../widgets/how_to_play_content_test.dart | 8 +-- .../widgets/play_now_button_test.dart | 2 +- .../bloc/leaderboard_bloc_test.dart | 14 ++--- .../bloc/leaderboard_state_test.dart | 6 +- .../view/leaderboard_success_test.dart | 26 ++++----- test/player/bloc/player_bloc_test.dart | 58 +++++++++---------- test/player/bloc/player_event_test.dart | 10 ++-- test/player/bloc/player_state_test.dart | 10 ++-- .../view/player_ranking_information_test.dart | 6 +- test/share/widgets/share_image_test.dart | 17 +++--- .../view/team_selection_page_test.dart | 26 ++++----- .../team_selection_mascot_platform_test.dart | 20 +++---- .../widgets/team_selection_mascot_test.dart | 18 +++--- .../view/word_success_view_test.dart | 2 +- .../widgets/word_selection_top_bar_test.dart | 4 +- 56 files changed, 317 insertions(+), 320 deletions(-) diff --git a/api/packages/crossword_repository/lib/src/crossword_repository.dart b/api/packages/crossword_repository/lib/src/crossword_repository.dart index cac16e3ee..72749feaf 100644 --- a/api/packages/crossword_repository/lib/src/crossword_repository.dart +++ b/api/packages/crossword_repository/lib/src/crossword_repository.dart @@ -82,7 +82,7 @@ class CrosswordRepository { /// The second value returns true if the answer was previously answered. Future<(bool, bool)> answerWord( String wordId, - Mascots mascot, + Mascot mascot, String userAnswer, ) async { final correctAnswer = await findAnswerById(wordId); diff --git a/api/packages/crossword_repository/test/src/crossword_repository_test.dart b/api/packages/crossword_repository/test/src/crossword_repository_test.dart index b1019217f..074802e5f 100644 --- a/api/packages/crossword_repository/test/src/crossword_repository_test.dart +++ b/api/packages/crossword_repository/test/src/crossword_repository_test.dart @@ -164,7 +164,7 @@ void main() { answer: 'solved', clue: '', solvedTimestamp: 12343, - mascot: Mascots.sparky, + mascot: Mascot.sparky, ); setUp(() { @@ -296,8 +296,7 @@ void main() { final time = DateTime.now(); final clock = Clock.fixed(time); await withClock(clock, () async { - final valid = - await repository.answerWord('4', Mascots.dino, 'solved'); + final valid = await repository.answerWord('4', Mascot.dino, 'solved'); expect(valid, (true, true)); }); }); @@ -308,7 +307,7 @@ void main() { final clock = Clock.fixed(time); await withClock(clock, () async { final valid = - await repository.answerWord('1', Mascots.dino, 'flutter'); + await repository.answerWord('1', Mascot.dino, 'flutter'); expect(valid, (true, false)); verify( @@ -338,7 +337,7 @@ void main() { word .copyWith( solvedTimestamp: time.millisecondsSinceEpoch, - mascot: Mascots.dino, + mascot: Mascot.dino, answer: 'flutter', ) .toJson(), @@ -352,7 +351,7 @@ void main() { }); test('returns (false, false) if answer is incorrect', () async { - final valid = await repository.answerWord('1', Mascots.dino, 'android'); + final valid = await repository.answerWord('1', Mascot.dino, 'android'); expect(valid, (false, false)); }); @@ -363,7 +362,7 @@ void main() { () => dbClient.getById(answersCollection, 'fake'), ).thenAnswer((_) async => null); expect( - () => repository.answerWord('fake', Mascots.dino, 'flutter'), + () => repository.answerWord('fake', Mascot.dino, 'flutter'), throwsA(isA()), ); }, @@ -396,7 +395,7 @@ void main() { ).thenAnswer((_) async => answersRecord); expect( - () => repository.answerWord('3', Mascots.sparky, 'happy'), + () => repository.answerWord('3', Mascot.sparky, 'happy'), throwsA(isA()), ); }, @@ -413,7 +412,7 @@ void main() { ).thenAnswer((_) async => []); expect( - () => repository.answerWord('1', Mascots.dino, 'flutter'), + () => repository.answerWord('1', Mascot.dino, 'flutter'), throwsA(isA()), ); }, @@ -435,7 +434,7 @@ void main() { () => dbClient.getById(answersCollection, 'fake'), ).thenAnswer((_) async => answersRecord); expect( - () => repository.answerWord('fake', Mascots.dino, 'flutter'), + () => repository.answerWord('fake', Mascot.dino, 'flutter'), throwsA(isA()), ); }, diff --git a/api/packages/game_domain/lib/src/models/mascots.dart b/api/packages/game_domain/lib/src/models/mascots.dart index f758911c8..caf5c75a0 100644 --- a/api/packages/game_domain/lib/src/models/mascots.dart +++ b/api/packages/game_domain/lib/src/models/mascots.dart @@ -1,7 +1,7 @@ /// {@template mascots} /// Google Mascots enum. /// {@endtemplate} -enum Mascots { +enum Mascot { /// Flutter Dash mascot. dash, diff --git a/api/packages/game_domain/lib/src/models/player.dart b/api/packages/game_domain/lib/src/models/player.dart index ea72a1f4f..0817d61ce 100644 --- a/api/packages/game_domain/lib/src/models/player.dart +++ b/api/packages/game_domain/lib/src/models/player.dart @@ -25,7 +25,7 @@ class Player extends Equatable { static const empty = Player( id: '', initials: '', - mascot: Mascots.dash, + mascot: Mascot.dash, ); /// Unique identifier of the leaderboard player object @@ -47,14 +47,14 @@ class Player extends Equatable { /// The player mascot. @JsonKey() - final Mascots mascot; + final Mascot mascot; /// Returns a copy of [Player] this instance with the /// provided fields. Player copyWith({ String? id, String? initials, - Mascots? mascot, + Mascot? mascot, int? score, int? streak, }) { diff --git a/api/packages/game_domain/lib/src/models/player.g.dart b/api/packages/game_domain/lib/src/models/player.g.dart index c02be36bf..209c9ffa5 100644 --- a/api/packages/game_domain/lib/src/models/player.g.dart +++ b/api/packages/game_domain/lib/src/models/player.g.dart @@ -9,7 +9,7 @@ part of 'player.dart'; Player _$PlayerFromJson(Map json) => Player( id: json['id'] as String, initials: json['initials'] as String, - mascot: $enumDecode(_$MascotsEnumMap, json['mascot']), + mascot: $enumDecode(_$MascotEnumMap, json['mascot']), score: (json['score'] as num?)?.toInt() ?? 0, streak: (json['streak'] as num?)?.toInt() ?? 0, ); @@ -18,12 +18,12 @@ Map _$PlayerToJson(Player instance) => { 'score': instance.score, 'streak': instance.streak, 'initials': instance.initials, - 'mascot': _$MascotsEnumMap[instance.mascot]!, + 'mascot': _$MascotEnumMap[instance.mascot]!, }; -const _$MascotsEnumMap = { - Mascots.dash: 'dash', - Mascots.sparky: 'sparky', - Mascots.android: 'android', - Mascots.dino: 'dino', +const _$MascotEnumMap = { + Mascot.dash: 'dash', + Mascot.sparky: 'sparky', + Mascot.android: 'android', + Mascot.dino: 'dino', }; diff --git a/api/packages/game_domain/lib/src/models/word.dart b/api/packages/game_domain/lib/src/models/word.dart index 3cd51b449..90e9197db 100644 --- a/api/packages/game_domain/lib/src/models/word.dart +++ b/api/packages/game_domain/lib/src/models/word.dart @@ -66,7 +66,7 @@ class Word extends Equatable { /// The mascot of the user that first solved the word. /// If the word is not solved, this value is null. @JsonKey() - final Mascots? mascot; + final Mascot? mascot; /// Returns the solved characters with the index position and character /// solved. @@ -95,7 +95,7 @@ class Word extends Equatable { String? clue, String? answer, int? solvedTimestamp, - Mascots? mascot, + Mascot? mascot, }) { return Word( id: id ?? this.id, diff --git a/api/packages/game_domain/lib/src/models/word.g.dart b/api/packages/game_domain/lib/src/models/word.g.dart index e46458a02..fa231e11f 100644 --- a/api/packages/game_domain/lib/src/models/word.g.dart +++ b/api/packages/game_domain/lib/src/models/word.g.dart @@ -14,7 +14,7 @@ Word _$WordFromJson(Map json) => Word( clue: json['clue'] as String, answer: json['answer'] as String, solvedTimestamp: (json['solvedTimestamp'] as num?)?.toInt(), - mascot: $enumDecodeNullable(_$MascotsEnumMap, json['mascot']), + mascot: $enumDecodeNullable(_$MascotEnumMap, json['mascot']), ); Map _$WordToJson(Word instance) => { @@ -24,7 +24,7 @@ Map _$WordToJson(Word instance) => { 'clue': instance.clue, 'answer': instance.answer, 'solvedTimestamp': instance.solvedTimestamp, - 'mascot': _$MascotsEnumMap[instance.mascot], + 'mascot': _$MascotEnumMap[instance.mascot], }; const _$WordAxisEnumMap = { @@ -32,9 +32,9 @@ const _$WordAxisEnumMap = { WordAxis.vertical: 'vertical', }; -const _$MascotsEnumMap = { - Mascots.dash: 'dash', - Mascots.sparky: 'sparky', - Mascots.android: 'android', - Mascots.dino: 'dino', +const _$MascotEnumMap = { + Mascot.dash: 'dash', + Mascot.sparky: 'sparky', + Mascot.android: 'android', + Mascot.dino: 'dino', }; diff --git a/api/packages/game_domain/test/src/models/board_section_test.dart b/api/packages/game_domain/test/src/models/board_section_test.dart index f6d3f4508..3d70dda58 100644 --- a/api/packages/game_domain/test/src/models/board_section_test.dart +++ b/api/packages/game_domain/test/src/models/board_section_test.dart @@ -18,7 +18,7 @@ void main() { answer: 'answer', clue: 'clue', solvedTimestamp: 1234, - mascot: Mascots.android, + mascot: Mascot.android, ), ], ); @@ -74,7 +74,7 @@ void main() { answer: 'answer', clue: 'clue', solvedTimestamp: 1234, - mascot: Mascots.android, + mascot: Mascot.android, ), ], ), diff --git a/api/packages/game_domain/test/src/models/player_test.dart b/api/packages/game_domain/test/src/models/player_test.dart index ffcdfcba8..5755ee28c 100644 --- a/api/packages/game_domain/test/src/models/player_test.dart +++ b/api/packages/game_domain/test/src/models/player_test.dart @@ -12,7 +12,7 @@ void main() { Player( id: '', initials: '', - mascot: Mascots.dash, + mascot: Mascot.dash, ), ), ); @@ -24,7 +24,7 @@ void main() { id: 'id', initials: 'TST', score: 10, - mascot: Mascots.android, + mascot: Mascot.android, streak: 2, ), isNotNull, @@ -35,7 +35,7 @@ void main() { id: 'id', initials: 'TST', score: 20, - mascot: Mascots.android, + mascot: Mascot.android, streak: 2, ); @@ -45,7 +45,7 @@ void main() { equals({ 'initials': 'TST', 'score': 20, - 'mascot': Mascots.android.name, + 'mascot': Mascot.android.name, 'streak': 2, }), ); @@ -57,7 +57,7 @@ void main() { 'id': 'id', 'initials': 'TST', 'score': 20, - 'mascot': Mascots.android.name, + 'mascot': Mascot.android.name, 'streak': 2, }), equals(leaderboardPlayer), @@ -70,7 +70,7 @@ void main() { id: '', initials: 'TST', score: 20, - mascot: Mascots.android, + mascot: Mascot.android, streak: 2, ), equals( @@ -78,7 +78,7 @@ void main() { id: '', initials: 'TST', score: 20, - mascot: Mascots.android, + mascot: Mascot.android, streak: 2, ), ), @@ -89,7 +89,7 @@ void main() { id: '', initials: 'TST', score: 20, - mascot: Mascots.android, + mascot: Mascot.android, streak: 2, ), isNot( @@ -102,7 +102,7 @@ void main() { id: 'id', initials: 'WOW', score: 20, - mascot: Mascots.android, + mascot: Mascot.android, streak: 2, ), isNot( @@ -115,7 +115,7 @@ void main() { id: 'id', initials: 'TST', score: 20, - mascot: Mascots.dash, + mascot: Mascot.dash, streak: 2, ), isNot( @@ -128,7 +128,7 @@ void main() { id: 'id', initials: 'TST', score: 20, - mascot: Mascots.android, + mascot: Mascot.android, streak: 3, ), isNot( @@ -142,7 +142,7 @@ void main() { Player( id: 'id', initials: 'AAA', - mascot: Mascots.android, + mascot: Mascot.android, streak: 10, score: 500, ).copyWith(), @@ -150,11 +150,11 @@ void main() { Player( id: '', initials: '', - mascot: Mascots.dash, + mascot: Mascot.dash, ).copyWith( id: 'id', initials: 'AAA', - mascot: Mascots.android, + mascot: Mascot.android, streak: 10, score: 500, ), diff --git a/api/packages/game_domain/test/src/models/word_test.dart b/api/packages/game_domain/test/src/models/word_test.dart index ba4371435..35d870503 100644 --- a/api/packages/game_domain/test/src/models/word_test.dart +++ b/api/packages/game_domain/test/src/models/word_test.dart @@ -13,7 +13,7 @@ void main() { answer: 'test', clue: 'clue', solvedTimestamp: 0, - mascot: Mascots.sparky, + mascot: Mascot.sparky, ); final json = word.toJson(); @@ -50,7 +50,7 @@ void main() { axis: WordAxis.horizontal, answer: 'test', clue: 'clue', - mascot: Mascots.sparky, + mascot: Mascot.sparky, ), ), ); diff --git a/api/packages/leaderboard_repository/test/src/leaderboard_repository_test.dart b/api/packages/leaderboard_repository/test/src/leaderboard_repository_test.dart index 22f31be44..e9b8e3cc6 100644 --- a/api/packages/leaderboard_repository/test/src/leaderboard_repository_test.dart +++ b/api/packages/leaderboard_repository/test/src/leaderboard_repository_test.dart @@ -120,7 +120,7 @@ void main() { id: 'userId', score: 10, streak: 1, - mascot: Mascots.dash, + mascot: Mascot.dash, initials: 'ABC', ), ); @@ -136,7 +136,7 @@ void main() { id: 'userId', score: 20, streak: 1, - mascot: Mascots.dash, + mascot: Mascot.dash, initials: 'ABC', ), 30, @@ -208,7 +208,7 @@ void main() { id: 'userId', score: 20, streak: 3, - mascot: Mascots.dash, + mascot: Mascot.dash, initials: 'ABC', ), ), diff --git a/api/test/routes/game/answer_test.dart b/api/test/routes/game/answer_test.dart index 1b89f291c..ede9718e0 100644 --- a/api/test/routes/game/answer_test.dart +++ b/api/test/routes/game/answer_test.dart @@ -73,13 +73,13 @@ void main() { when(() => leaderboardRepository.getPlayer('userId')).thenAnswer( (_) async => Player( id: 'userId', - mascot: Mascots.dash, + mascot: Mascot.dash, initials: 'ABC', ), ); when( - () => crosswordRepository.answerWord('id', Mascots.dash, 'sun'), + () => crosswordRepository.answerWord('id', Mascot.dash, 'sun'), ).thenAnswer((_) async => (true, true)); when( () => leaderboardRepository.updateScore(user.id), @@ -106,13 +106,13 @@ void main() { when(() => leaderboardRepository.getPlayer('userId')).thenAnswer( (_) async => Player( id: 'userId', - mascot: Mascots.dash, + mascot: Mascot.dash, initials: 'ABC', ), ); when( - () => crosswordRepository.answerWord('id', Mascots.dash, 'sun'), + () => crosswordRepository.answerWord('id', Mascot.dash, 'sun'), ).thenAnswer((_) async => (true, true)); when( () => leaderboardRepository.updateScore(user.id), @@ -138,7 +138,7 @@ void main() { when(() => leaderboardRepository.getPlayer('userId')).thenAnswer( (_) async => Player( id: 'userId', - mascot: Mascots.dash, + mascot: Mascot.dash, initials: 'ABC', ), ); @@ -146,7 +146,7 @@ void main() { () => crosswordRepository.updateSolvedWordsCount(), ).thenAnswer((_) async {}); when( - () => crosswordRepository.answerWord('id', Mascots.dash, 'sun'), + () => crosswordRepository.answerWord('id', Mascot.dash, 'sun'), ).thenAnswer((_) async => (true, false)); when( () => leaderboardRepository.updateScore(user.id), @@ -172,12 +172,12 @@ void main() { when(() => leaderboardRepository.getPlayer('userId')).thenAnswer( (_) async => Player( id: 'userId', - mascot: Mascots.dash, + mascot: Mascot.dash, initials: 'ABC', ), ); when( - () => crosswordRepository.answerWord('id', Mascots.dash, 'sun'), + () => crosswordRepository.answerWord('id', Mascot.dash, 'sun'), ).thenAnswer((_) async => (false, false)); when(() => request.json()).thenAnswer( (_) async => { @@ -255,12 +255,12 @@ void main() { when(() => leaderboardRepository.getPlayer('userId')).thenAnswer( (_) async => Player( id: 'userId', - mascot: Mascots.dash, + mascot: Mascot.dash, initials: 'ABC', ), ); when( - () => crosswordRepository.answerWord('id', Mascots.dash, 'sun'), + () => crosswordRepository.answerWord('id', Mascot.dash, 'sun'), ).thenThrow(Exception('Oops')); final response = await route.onRequest(requestContext); diff --git a/lib/app/view/app.dart b/lib/app/view/app.dart index 01a4ebd95..057b0c18f 100644 --- a/lib/app/view/app.dart +++ b/lib/app/view/app.dart @@ -101,7 +101,7 @@ class AppView extends StatelessWidget { @override Widget build(BuildContext context) { return IoLayout( - child: BlocSelector( + child: BlocSelector( selector: (state) { return state.mascot; }, @@ -127,7 +127,7 @@ class AppView extends StatelessWidget { } @visibleForTesting -extension MascotTheme on Mascots { +extension MascotTheme on Mascot { static final flutterTheme = IoFlutterTheme().themeData; static final firebaseTheme = IoFirebaseTheme().themeData; static final chromeTheme = IoChromeTheme().themeData; @@ -135,13 +135,13 @@ extension MascotTheme on Mascots { ThemeData theme() { switch (this) { - case Mascots.dash: + case Mascot.dash: return flutterTheme; - case Mascots.sparky: + case Mascot.sparky: return firebaseTheme; - case Mascots.dino: + case Mascot.dino: return chromeTheme; - case Mascots.android: + case Mascot.android: return androidTheme; } } diff --git a/lib/crossword/view/crossword_board_view.dart b/lib/crossword/view/crossword_board_view.dart index 4c7b95d67..8c9424862 100644 --- a/lib/crossword/view/crossword_board_view.dart +++ b/lib/crossword/view/crossword_board_view.dart @@ -226,24 +226,23 @@ extension on WordAxis { this == WordAxis.horizontal ? Axis.horizontal : Axis.vertical; } -extension on Mascots { +extension on Mascot { IoWordStyle toIoWordStyle(ThemeData theme) { return theme.io.wordTheme.big.copyWith( borderRadius: BorderRadius.zero, margin: theme.io.wordInput.secondary.padding, boxSize: theme.io.wordInput.secondary.filled.size, textStyle: switch (this) { - Mascots.dash => theme.io.crosswordLetterTheme.dash.textStyle, - Mascots.sparky => theme.io.crosswordLetterTheme.sparky.textStyle, - Mascots.dino => theme.io.crosswordLetterTheme.dino.textStyle, - Mascots.android => theme.io.crosswordLetterTheme.android.textStyle, + Mascot.dash => theme.io.crosswordLetterTheme.dash.textStyle, + Mascot.sparky => theme.io.crosswordLetterTheme.sparky.textStyle, + Mascot.dino => theme.io.crosswordLetterTheme.dino.textStyle, + Mascot.android => theme.io.crosswordLetterTheme.android.textStyle, }, backgroundColor: switch (this) { - Mascots.dash => theme.io.crosswordLetterTheme.dash.backgroundColor, - Mascots.sparky => theme.io.crosswordLetterTheme.sparky.backgroundColor, - Mascots.dino => theme.io.crosswordLetterTheme.dino.backgroundColor, - Mascots.android => - theme.io.crosswordLetterTheme.android.backgroundColor, + Mascot.dash => theme.io.crosswordLetterTheme.dash.backgroundColor, + Mascot.sparky => theme.io.crosswordLetterTheme.sparky.backgroundColor, + Mascot.dino => theme.io.crosswordLetterTheme.dino.backgroundColor, + Mascot.android => theme.io.crosswordLetterTheme.android.backgroundColor, }, ); } diff --git a/lib/crossword/view/crossword_page.dart b/lib/crossword/view/crossword_page.dart index 47a1668fa..aeddc95c7 100644 --- a/lib/crossword/view/crossword_page.dart +++ b/lib/crossword/view/crossword_page.dart @@ -245,7 +245,7 @@ class MascotAnimation extends StatelessWidget { super.key, }); - final Mascots mascot; + final Mascot mascot; final SpriteListController controller; @override diff --git a/lib/crossword/widgets/crossword_letter.dart b/lib/crossword/widgets/crossword_letter.dart index 61fdbeb73..4a84656a4 100644 --- a/lib/crossword/widgets/crossword_letter.dart +++ b/lib/crossword/widgets/crossword_letter.dart @@ -144,7 +144,7 @@ extension on CrosswordLetterWords { /// Returns the mascot of the first team that resolved the letter. /// /// If `null`, no team has yet resolved the letter. - Mascots? mascot() { + Mascot? mascot() { return switch (($1?.isSolved ?? false, $2?.isSolved ?? false)) { (false, false) => null, (true, false) => $1!.mascot, @@ -156,13 +156,13 @@ extension on CrosswordLetterWords { } extension on IoCrosswordLetterTheme { - IoCrosswordLetterStyle fromMascot(Mascots? mascot) { + IoCrosswordLetterStyle fromMascot(Mascot? mascot) { return switch (mascot) // coverage:ignore-line { - Mascots.android => android, - Mascots.dash => dash, - Mascots.dino => dino, - Mascots.sparky => sparky, + Mascot.android => android, + Mascot.dash => dash, + Mascot.dino => dino, + Mascot.sparky => sparky, _ => empty, }; } diff --git a/lib/end_game/view/end_game_view_content.dart b/lib/end_game/view/end_game_view_content.dart index 68f6489ed..585cb39f3 100644 --- a/lib/end_game/view/end_game_view_content.dart +++ b/lib/end_game/view/end_game_view_content.dart @@ -120,10 +120,10 @@ class EndGameImage extends StatelessWidget { context.select((PlayerBloc bloc) => bloc.state.player.mascot); final image = switch (mascot) { - Mascots.dash => Assets.images.endGameDash, - Mascots.android => Assets.images.endGameAndroid, - Mascots.dino => Assets.images.endGameDino, - Mascots.sparky => Assets.images.endGameSparky, + Mascot.dash => Assets.images.endGameDash, + Mascot.android => Assets.images.endGameAndroid, + Mascot.dino => Assets.images.endGameDino, + Mascot.sparky => Assets.images.endGameSparky, }; return image.image( diff --git a/lib/extensions/mascot_color.dart b/lib/extensions/mascot_color.dart index 47cd22961..b48841fe2 100644 --- a/lib/extensions/mascot_color.dart +++ b/lib/extensions/mascot_color.dart @@ -2,13 +2,13 @@ import 'package:flutter/material.dart'; import 'package:game_domain/game_domain.dart'; import 'package:io_crossword_ui/io_crossword_ui.dart'; -extension MascotColor on Mascots? { +extension MascotColor on Mascot? { Color get color { return switch (this) { - Mascots.dash => IoCrosswordColors.flutterBlue, - Mascots.sparky => IoCrosswordColors.sparkyYellow, - Mascots.dino => IoCrosswordColors.accessibleGrey, - Mascots.android => IoCrosswordColors.androidGreen, + Mascot.dash => IoCrosswordColors.flutterBlue, + Mascot.sparky => IoCrosswordColors.sparkyYellow, + Mascot.dino => IoCrosswordColors.accessibleGrey, + Mascot.android => IoCrosswordColors.androidGreen, null => IoCrosswordColors.flutterBlue, }; } diff --git a/lib/how_to_play/cubit/how_to_play_cubit.dart b/lib/how_to_play/cubit/how_to_play_cubit.dart index 2a2a46fbd..b164e6c04 100644 --- a/lib/how_to_play/cubit/how_to_play_cubit.dart +++ b/lib/how_to_play/cubit/how_to_play_cubit.dart @@ -18,7 +18,7 @@ class HowToPlayCubit extends Cubit { emit(state.copyWith(status: status)); } - Future loadAssets(Mascots mascot) async { + Future loadAssets(Mascot mascot) async { emit( state.copyWith( assetsStatus: AssetsLoadingStatus.inProgress, diff --git a/lib/how_to_play/widgets/how_to_play_content.dart b/lib/how_to_play/widgets/how_to_play_content.dart index ab8f16306..cff0578d9 100644 --- a/lib/how_to_play/widgets/how_to_play_content.dart +++ b/lib/how_to_play/widgets/how_to_play_content.dart @@ -15,7 +15,7 @@ class HowToPlayContent extends StatefulWidget { super.key, }); - final Mascots mascot; + final Mascot mascot; final VoidCallback onDonePressed; @override diff --git a/lib/leaderboard/bloc/leaderboard_bloc.dart b/lib/leaderboard/bloc/leaderboard_bloc.dart index 99dcfbd25..2dbd1ad47 100644 --- a/lib/leaderboard/bloc/leaderboard_bloc.dart +++ b/lib/leaderboard/bloc/leaderboard_bloc.dart @@ -35,7 +35,7 @@ class LeaderboardBloc extends Bloc { (index) => const Player( id: '', initials: 'AAA', - mascot: Mascots.dash, + mascot: Mascot.dash, ), ), ), diff --git a/lib/leaderboard/view/leaderboard_success.dart b/lib/leaderboard/view/leaderboard_success.dart index 4676c9b17..2774dd75d 100644 --- a/lib/leaderboard/view/leaderboard_success.dart +++ b/lib/leaderboard/view/leaderboard_success.dart @@ -174,10 +174,10 @@ class UserLeaderboardRanking extends StatelessWidget { final themeData = Theme.of(context); final style = themeData.io.wordTheme.small.copyWith( backgroundColor: switch (player.mascot) { - Mascots.dash => IoCrosswordColors.flutterBlue, - Mascots.sparky => IoCrosswordColors.sparkyYellow, - Mascots.dino => IoCrosswordColors.chromeRed, - Mascots.android => IoCrosswordColors.androidGreen, + Mascot.dash => IoCrosswordColors.flutterBlue, + Mascot.sparky => IoCrosswordColors.sparkyYellow, + Mascot.dino => IoCrosswordColors.chromeRed, + Mascot.android => IoCrosswordColors.androidGreen, }, ); diff --git a/lib/player/bloc/player_event.dart b/lib/player/bloc/player_event.dart index 8fe654adb..0f80e39ae 100644 --- a/lib/player/bloc/player_event.dart +++ b/lib/player/bloc/player_event.dart @@ -25,7 +25,7 @@ class PlayerCreateScoreRequested extends PlayerEvent { class MascotSelected extends PlayerEvent { const MascotSelected(this.mascot); - final Mascots mascot; + final Mascot mascot; @override List get props => [mascot]; diff --git a/lib/player/bloc/player_state.dart b/lib/player/bloc/player_state.dart index 1d61ba896..668389557 100644 --- a/lib/player/bloc/player_state.dart +++ b/lib/player/bloc/player_state.dart @@ -12,14 +12,14 @@ class PlayerState extends Equatable { this.status = PlayerStatus.onboarding, this.player = Player.empty, this.rank = 0, - this.mascot = Mascots.dash, + this.mascot = Mascot.dash, }); PlayerState copyWith({ PlayerStatus? status, Player? player, int? rank, - Mascots? mascot, + Mascot? mascot, }) { return PlayerState( status: status ?? this.status, @@ -32,7 +32,7 @@ class PlayerState extends Equatable { final PlayerStatus status; final Player player; final int rank; - final Mascots mascot; + final Mascot mascot; @override List get props => [status, player, rank, mascot]; diff --git a/lib/share/widgets/share_image.dart b/lib/share/widgets/share_image.dart index 0b4f0309c..19a3c42d6 100644 --- a/lib/share/widgets/share_image.dart +++ b/lib/share/widgets/share_image.dart @@ -13,10 +13,10 @@ class ShareImage extends StatelessWidget { context.select((PlayerBloc bloc) => bloc.state.player.mascot); final image = switch (mascot) { - Mascots.dash => Assets.images.shareDash, - Mascots.android => Assets.images.shareAndroid, - Mascots.dino => Assets.images.shareDino, - Mascots.sparky => Assets.images.shareSparky, + Mascot.dash => Assets.images.shareDash, + Mascot.android => Assets.images.shareAndroid, + Mascot.dino => Assets.images.shareDino, + Mascot.sparky => Assets.images.shareSparky, }; return image.image( diff --git a/lib/team_selection/cubit/team_selection_cubit.dart b/lib/team_selection/cubit/team_selection_cubit.dart index 03415e0c4..5b85a8dbd 100644 --- a/lib/team_selection/cubit/team_selection_cubit.dart +++ b/lib/team_selection/cubit/team_selection_cubit.dart @@ -23,10 +23,10 @@ class TeamSelectionCubit extends Cubit { Flame.images.clearCache(); await Flame.images.loadAll([ - ...Mascots.dash.teamMascot.loadableTeamSelectionAssets(), - ...Mascots.sparky.teamMascot.loadableTeamSelectionAssets(), - ...Mascots.android.teamMascot.loadableTeamSelectionAssets(), - ...Mascots.dino.teamMascot.loadableTeamSelectionAssets(), + ...Mascot.dash.teamMascot.loadableTeamSelectionAssets(), + ...Mascot.sparky.teamMascot.loadableTeamSelectionAssets(), + ...Mascot.android.teamMascot.loadableTeamSelectionAssets(), + ...Mascot.dino.teamMascot.loadableTeamSelectionAssets(), ]); if (!isClosed) { diff --git a/lib/team_selection/view/team_selection_page.dart b/lib/team_selection/view/team_selection_page.dart index 05f7ce0a8..681217c28 100644 --- a/lib/team_selection/view/team_selection_page.dart +++ b/lib/team_selection/view/team_selection_page.dart @@ -56,7 +56,7 @@ class TeamSelectionView extends StatelessWidget { listener: (context, state) { context .read() - .add(MascotSelected(Mascots.values[state.index])); + .add(MascotSelected(Mascot.values[state.index])); }, buildWhen: (previous, current) => previous.assetsStatus != current.assetsStatus, @@ -113,7 +113,7 @@ class _TeamSelectorLarge extends StatelessWidget { child: SizedBox( width: tileWidth, height: platformTileHeight, - child: _TeamPlatform(Mascots.dash), + child: _TeamPlatform(Mascot.dash), ), ), Positioned( @@ -122,7 +122,7 @@ class _TeamSelectorLarge extends StatelessWidget { child: SizedBox( width: tileWidth, height: platformTileHeight, - child: _TeamPlatform(Mascots.sparky), + child: _TeamPlatform(Mascot.sparky), ), ), Positioned( @@ -131,7 +131,7 @@ class _TeamSelectorLarge extends StatelessWidget { child: SizedBox( width: tileWidth, height: platformTileHeight, - child: _TeamPlatform(Mascots.android), + child: _TeamPlatform(Mascot.android), ), ), Positioned( @@ -140,7 +140,7 @@ class _TeamSelectorLarge extends StatelessWidget { child: SizedBox( width: tileWidth, height: platformTileHeight, - child: _TeamPlatform(Mascots.dino), + child: _TeamPlatform(Mascot.dino), ), ), ], @@ -160,7 +160,7 @@ class _TeamSelectorLarge extends StatelessWidget { child: SizedBox( width: mascotWidth, height: mascotHeight, - child: _LargeMascot(Mascots.dash), + child: _LargeMascot(Mascot.dash), ), ), Positioned( @@ -169,7 +169,7 @@ class _TeamSelectorLarge extends StatelessWidget { child: SizedBox( width: mascotWidth, height: mascotHeight, - child: _LargeMascot(Mascots.sparky), + child: _LargeMascot(Mascot.sparky), ), ), Positioned( @@ -178,7 +178,7 @@ class _TeamSelectorLarge extends StatelessWidget { child: SizedBox( width: mascotWidth, height: mascotHeight, - child: _LargeMascot(Mascots.android), + child: _LargeMascot(Mascot.android), ), ), Positioned( @@ -187,7 +187,7 @@ class _TeamSelectorLarge extends StatelessWidget { child: SizedBox( width: mascotWidth, height: mascotHeight, - child: _LargeMascot(Mascots.dino), + child: _LargeMascot(Mascot.dino), ), ), ], @@ -319,14 +319,14 @@ class _TeamSelectorSmallState extends State<_TeamSelectorSmall> SizedBox( width: _TeamSelectorSmall.tileWidth, height: _TeamSelectorSmall.platformTileHeight, - child: _TeamPlatform(Mascots.dash), + child: _TeamPlatform(Mascot.dash), ), Positioned( left: _TeamSelectorSmall.tileWidth * 2, child: SizedBox( width: _TeamSelectorSmall.tileWidth, height: _TeamSelectorSmall.platformTileHeight, - child: _TeamPlatform(Mascots.sparky), + child: _TeamPlatform(Mascot.sparky), ), ), Positioned( @@ -334,7 +334,7 @@ class _TeamSelectorSmallState extends State<_TeamSelectorSmall> child: SizedBox( width: _TeamSelectorSmall.tileWidth, height: _TeamSelectorSmall.platformTileHeight, - child: _TeamPlatform(Mascots.android), + child: _TeamPlatform(Mascot.android), ), ), Positioned( @@ -342,7 +342,7 @@ class _TeamSelectorSmallState extends State<_TeamSelectorSmall> child: SizedBox( width: _TeamSelectorSmall.tileWidth, height: _TeamSelectorSmall.platformTileHeight, - child: _TeamPlatform(Mascots.dino), + child: _TeamPlatform(Mascot.dino), ), ), ], @@ -365,7 +365,7 @@ class _TeamSelectorSmallState extends State<_TeamSelectorSmall> child: SizedBox( width: 200, height: 400, - child: _SmallMascot(Mascots.dash), + child: _SmallMascot(Mascot.dash), ), ), Positioned( @@ -373,7 +373,7 @@ class _TeamSelectorSmallState extends State<_TeamSelectorSmall> child: SizedBox( width: 200, height: 400, - child: _SmallMascot(Mascots.sparky), + child: _SmallMascot(Mascot.sparky), ), ), Positioned( @@ -381,7 +381,7 @@ class _TeamSelectorSmallState extends State<_TeamSelectorSmall> child: SizedBox( width: 200, height: 400, - child: _SmallMascot(Mascots.android), + child: _SmallMascot(Mascot.android), ), ), Positioned( @@ -389,7 +389,7 @@ class _TeamSelectorSmallState extends State<_TeamSelectorSmall> child: SizedBox( width: 200, height: 400, - child: _SmallMascot(Mascots.dino), + child: _SmallMascot(Mascot.dino), ), ), ], @@ -445,12 +445,12 @@ class _TeamSelector extends StatelessWidget { ), Flexible( child: Text( - Mascots.values[index].teamMascot.name, + Mascot.values[index].teamMascot.name, style: textTheme.heading1, ), ), IconButton( - onPressed: index < Mascots.values.length - 1 + onPressed: index < Mascot.values.length - 1 ? () { context .read() @@ -463,7 +463,7 @@ class _TeamSelector extends StatelessWidget { ), ), const SizedBox(height: 32), - _SubmitButton(Mascots.values[index]), + _SubmitButton(Mascot.values[index]), ], ); } @@ -472,7 +472,7 @@ class _TeamSelector extends StatelessWidget { class _SubmitButton extends StatelessWidget { const _SubmitButton(this.mascot); - final Mascots mascot; + final Mascot mascot; @override Widget build(BuildContext context) { @@ -493,16 +493,16 @@ class _SubmitButton extends StatelessWidget { } } -extension TeamMascot on Mascots { +extension TeamMascot on Mascot { Team get teamMascot { switch (this) { - case Mascots.dash: + case Mascot.dash: return const DashTeam(); - case Mascots.sparky: + case Mascot.sparky: return const SparkyTeam(); - case Mascots.android: + case Mascot.android: return const AndroidTeam(); - case Mascots.dino: + case Mascot.dino: return const DinoTeam(); } } @@ -513,7 +513,7 @@ class _TeamPlatform extends StatelessWidget { this.mascot, ); - final Mascots mascot; + final Mascot mascot; @override Widget build(BuildContext context) { @@ -532,7 +532,7 @@ class _SmallMascot extends StatelessWidget { this.mascot, ); - final Mascots mascot; + final Mascot mascot; @override Widget build(BuildContext context) { @@ -551,7 +551,7 @@ class _SmallMascot extends StatelessWidget { class _LargeMascot extends StatelessWidget { const _LargeMascot(this.mascot); - final Mascots mascot; + final Mascot mascot; @override Widget build(BuildContext context) { diff --git a/lib/team_selection/widgets/team_selection_mascot.dart b/lib/team_selection/widgets/team_selection_mascot.dart index 15f9d3098..28ab1d521 100644 --- a/lib/team_selection/widgets/team_selection_mascot.dart +++ b/lib/team_selection/widgets/team_selection_mascot.dart @@ -7,7 +7,7 @@ import 'package:io_crossword/team_selection/team_selection.dart'; class TeamSelectionMascot extends StatelessWidget { const TeamSelectionMascot(this.mascot, {super.key}); - final Mascots mascot; + final Mascot mascot; @override Widget build(BuildContext context) { diff --git a/lib/team_selection/widgets/team_selection_mascot_platform.dart b/lib/team_selection/widgets/team_selection_mascot_platform.dart index 2830e37e9..6c0ac8bdb 100644 --- a/lib/team_selection/widgets/team_selection_mascot_platform.dart +++ b/lib/team_selection/widgets/team_selection_mascot_platform.dart @@ -12,7 +12,7 @@ class TeamSelectionMascotPlatform extends StatelessWidget { super.key, }); - final Mascots mascot; + final Mascot mascot; final bool selected; diff --git a/lib/word_selection/widgets/word_selection_top_bar.dart b/lib/word_selection/widgets/word_selection_top_bar.dart index 4ae2147a8..dc25feffb 100644 --- a/lib/word_selection/widgets/word_selection_top_bar.dart +++ b/lib/word_selection/widgets/word_selection_top_bar.dart @@ -47,7 +47,7 @@ class WordSelectionTopBar extends StatelessWidget { if (word == null) return const SizedBox.shrink(); final l10n = context.l10n; - final mascot = context.select( + final mascot = context.select( (bloc) { final currentWord = bloc.state.sections[word.section]?.words .firstWhere((element) => element.id == word.word.id); diff --git a/packages/api_client/lib/src/resources/leaderboard_resource.dart b/packages/api_client/lib/src/resources/leaderboard_resource.dart index d1b7e289c..ea9954468 100644 --- a/packages/api_client/lib/src/resources/leaderboard_resource.dart +++ b/packages/api_client/lib/src/resources/leaderboard_resource.dart @@ -50,7 +50,7 @@ class LeaderboardResource { /// Post /game/leaderboard/create_score Future createScore({ required String initials, - required Mascots mascot, + required Mascot mascot, }) async { final response = await _apiClient.post( '/game/create_score', diff --git a/packages/api_client/test/src/resources/leaderboard_resource_test.dart b/packages/api_client/test/src/resources/leaderboard_resource_test.dart index 800b89af1..65f7f4f75 100644 --- a/packages/api_client/test/src/resources/leaderboard_resource_test.dart +++ b/packages/api_client/test/src/resources/leaderboard_resource_test.dart @@ -98,7 +98,7 @@ void main() { when(() => response.statusCode).thenReturn(HttpStatus.created); await resource.createScore( initials: 'TST', - mascot: Mascots.dino, + mascot: Mascot.dino, ); verify( @@ -118,7 +118,7 @@ void main() { when(() => response.body).thenReturn('Oops'); await expectLater( - () => resource.createScore(initials: 'TST', mascot: Mascots.dino), + () => resource.createScore(initials: 'TST', mascot: Mascot.dino), throwsA( isA().having( (e) => e.cause, diff --git a/packages/leaderboard_repository/test/src/leaderboard_repository_test.dart b/packages/leaderboard_repository/test/src/leaderboard_repository_test.dart index a70fa06ec..a4c85e31d 100644 --- a/packages/leaderboard_repository/test/src/leaderboard_repository_test.dart +++ b/packages/leaderboard_repository/test/src/leaderboard_repository_test.dart @@ -23,49 +23,49 @@ void main() { initials: 'AAA', score: 9010, streak: 950, - mascot: Mascots.android, + mascot: Mascot.android, ), Player( id: 'userId-2', initials: 'BBB', score: 8010, streak: 750, - mascot: Mascots.dash, + mascot: Mascot.dash, ), Player( id: 'userId-3', initials: 'CCC', score: 7010, streak: 650, - mascot: Mascots.sparky, + mascot: Mascot.sparky, ), Player( id: 'userId-4', initials: 'DDD', score: 6010, streak: 350, - mascot: Mascots.dino, + mascot: Mascot.dino, ), Player( id: 'userId-5', initials: 'EEE', score: 5010, streak: 250, - mascot: Mascots.dash, + mascot: Mascot.dash, ), Player( id: 'userId-6', initials: 'FFF', score: 410, streak: 150, - mascot: Mascots.dino, + mascot: Mascot.dino, ), Player( id: 'userId-7', initials: 'GGG', score: 310, streak: 50, - mascot: Mascots.android, + mascot: Mascot.android, ), ]; @@ -143,7 +143,7 @@ void main() { id: 'userId+$index', initials: 'AAA', score: 20, - mascot: Mascots.dash, + mascot: Mascot.dash, ), )) { await firestore.doc('players/${player.id}').set( diff --git a/test/app/view/app_test.dart b/test/app/view/app_test.dart index a5a5f441e..de6e14374 100644 --- a/test/app/view/app_test.dart +++ b/test/app/view/app_test.dart @@ -192,7 +192,7 @@ void main() { playerBloc, Stream.empty(), initialState: PlayerState( - mascot: Mascots.dash, + mascot: Mascot.dash, ), ); @@ -213,7 +213,7 @@ void main() { playerBloc, Stream.empty(), initialState: PlayerState( - mascot: Mascots.sparky, + mascot: Mascot.sparky, ), ); @@ -234,7 +234,7 @@ void main() { playerBloc, Stream.empty(), initialState: PlayerState( - mascot: Mascots.dino, + mascot: Mascot.dino, ), ); @@ -255,7 +255,7 @@ void main() { playerBloc, Stream.empty(), initialState: PlayerState( - mascot: Mascots.android, + mascot: Mascot.android, ), ); diff --git a/test/crossword/view/crossword_board_view_test.dart b/test/crossword/view/crossword_board_view_test.dart index 48d051b84..57870d5c4 100644 --- a/test/crossword/view/crossword_board_view_test.dart +++ b/test/crossword/view/crossword_board_view_test.dart @@ -91,7 +91,7 @@ void main() { testWidgets('when a solved word is selected', (tester) async { when(() => word.solvedTimestamp).thenReturn(1); when(() => word.isSolved).thenReturn(true); - when(() => word.mascot).thenReturn(Mascots.dash); + when(() => word.mascot).thenReturn(Mascot.dash); when(() => wordSelectionBloc.state).thenReturn( WordSelectionState( @@ -319,7 +319,7 @@ void main() { 'when word is solved', (tester) async { when(() => word.isSolved).thenReturn(true); - when(() => word.mascot).thenReturn(Mascots.dash); + when(() => word.mascot).thenReturn(Mascot.dash); when(() => word.solvedTimestamp).thenReturn(1); when(() => wordSelectionBloc.state).thenReturn( @@ -387,7 +387,7 @@ void main() { 'with answer when word is solved', (tester) async { when(() => word.isSolved).thenReturn(true); - when(() => word.mascot).thenReturn(Mascots.dash); + when(() => word.mascot).thenReturn(Mascot.dash); when(() => word.solvedTimestamp).thenReturn(1); await tester.pumpApp( @@ -410,7 +410,7 @@ void main() { 'horizontally when word is horizontal', (tester) async { when(() => word.isSolved).thenReturn(true); - when(() => word.mascot).thenReturn(Mascots.dash); + when(() => word.mascot).thenReturn(Mascot.dash); when(() => word.solvedTimestamp).thenReturn(1); when(() => word.axis).thenReturn(WordAxis.horizontal); @@ -434,7 +434,7 @@ void main() { 'vertically when word is vertical', (tester) async { when(() => word.isSolved).thenReturn(true); - when(() => word.mascot).thenReturn(Mascots.dash); + when(() => word.mascot).thenReturn(Mascot.dash); when(() => word.solvedTimestamp).thenReturn(1); when(() => word.axis).thenReturn(WordAxis.vertical); @@ -467,7 +467,7 @@ void main() { testWidgets( 'when word is solved by Dash', (tester) async { - when(() => word.mascot).thenReturn(Mascots.dash); + when(() => word.mascot).thenReturn(Mascot.dash); await tester.pumpApp( layout: IoLayoutData.large, @@ -502,7 +502,7 @@ void main() { testWidgets( 'when word is solved by Sparky', (tester) async { - when(() => word.mascot).thenReturn(Mascots.sparky); + when(() => word.mascot).thenReturn(Mascot.sparky); await tester.pumpApp( layout: IoLayoutData.large, @@ -537,7 +537,7 @@ void main() { testWidgets( 'when word is solved by Dino', (tester) async { - when(() => word.mascot).thenReturn(Mascots.dino); + when(() => word.mascot).thenReturn(Mascot.dino); await tester.pumpApp( layout: IoLayoutData.large, @@ -572,7 +572,7 @@ void main() { testWidgets( 'when word is solved by Android', (tester) async { - when(() => word.mascot).thenReturn(Mascots.android); + when(() => word.mascot).thenReturn(Mascot.android); await tester.pumpApp( layout: IoLayoutData.large, diff --git a/test/crossword/view/crossword_page_test.dart b/test/crossword/view/crossword_page_test.dart index 4ba9cd682..8f189cd1e 100644 --- a/test/crossword/view/crossword_page_test.dart +++ b/test/crossword/view/crossword_page_test.dart @@ -51,14 +51,14 @@ void main() { setUpAll(() async { Flame.images = Images(prefix: ''); await Flame.images.loadAll([ - ...Mascots.dash.teamMascot.loadableHowToPlayDesktopAssets(), - ...Mascots.dash.teamMascot.loadableHowToPlayMobileAssets(), - ...Mascots.android.teamMascot.loadableHowToPlayDesktopAssets(), - ...Mascots.android.teamMascot.loadableHowToPlayMobileAssets(), - ...Mascots.dino.teamMascot.loadableHowToPlayDesktopAssets(), - ...Mascots.dino.teamMascot.loadableHowToPlayMobileAssets(), - ...Mascots.sparky.teamMascot.loadableHowToPlayDesktopAssets(), - ...Mascots.sparky.teamMascot.loadableHowToPlayMobileAssets(), + ...Mascot.dash.teamMascot.loadableHowToPlayDesktopAssets(), + ...Mascot.dash.teamMascot.loadableHowToPlayMobileAssets(), + ...Mascot.android.teamMascot.loadableHowToPlayDesktopAssets(), + ...Mascot.android.teamMascot.loadableHowToPlayMobileAssets(), + ...Mascot.dino.teamMascot.loadableHowToPlayDesktopAssets(), + ...Mascot.dino.teamMascot.loadableHowToPlayMobileAssets(), + ...Mascot.sparky.teamMascot.loadableHowToPlayDesktopAssets(), + ...Mascot.sparky.teamMascot.loadableHowToPlayMobileAssets(), ]); }); diff --git a/test/crossword/widgets/crossword_letter_test.dart b/test/crossword/widgets/crossword_letter_test.dart index 910cd4841..9836fd31b 100644 --- a/test/crossword/widgets/crossword_letter_test.dart +++ b/test/crossword/widgets/crossword_letter_test.dart @@ -115,7 +115,7 @@ void main() { 'with horizontal word mascot when solved and vertical is null', (tester) async { final word = ant.copyWith( - mascot: Mascots.android, + mascot: Mascot.android, solvedTimestamp: 1, ); final letterData = CrosswordLetterData( @@ -148,7 +148,7 @@ void main() { 'with vertical word mascot when solved and horizontal is null', (tester) async { final word = ant.copyWith( - mascot: Mascots.dash, + mascot: Mascot.dash, solvedTimestamp: 1, ); final letterData = CrosswordLetterData( @@ -181,9 +181,9 @@ void main() { 'with horizontal word mascot when solved before vertical word', (tester) async { final horizontalWord = - ant.copyWith(mascot: Mascots.sparky, solvedTimestamp: 1); + ant.copyWith(mascot: Mascot.sparky, solvedTimestamp: 1); final verticalWord = - ant.copyWith(mascot: Mascots.dino, solvedTimestamp: 2); + ant.copyWith(mascot: Mascot.dino, solvedTimestamp: 2); final letterData = CrosswordLetterData( index: (0, 0), chunkIndex: (0, 0), @@ -214,9 +214,9 @@ void main() { 'with vertical word mascot when solved before horizontal word', (tester) async { final horizontalWord = - ant.copyWith(mascot: Mascots.sparky, solvedTimestamp: 2); + ant.copyWith(mascot: Mascot.sparky, solvedTimestamp: 2); final verticalWord = - ant.copyWith(mascot: Mascots.dino, solvedTimestamp: 1); + ant.copyWith(mascot: Mascot.dino, solvedTimestamp: 1); final letterData = CrosswordLetterData( index: (0, 0), chunkIndex: (0, 0), @@ -246,8 +246,8 @@ void main() { testWidgets( 'with empty style when both have not been solved', (tester) async { - final horizontalWord = ant.copyWith(mascot: Mascots.dash); - final verticalWord = ant.copyWith(mascot: Mascots.dino); + final horizontalWord = ant.copyWith(mascot: Mascot.dash); + final verticalWord = ant.copyWith(mascot: Mascot.dino); final letterData = CrosswordLetterData( index: (0, 0), chunkIndex: (0, 0), @@ -278,9 +278,9 @@ void main() { 'with horizontal word mascot when both have the same timestamp', (tester) async { final horizontalWord = - ant.copyWith(mascot: Mascots.dash, solvedTimestamp: 1); + ant.copyWith(mascot: Mascot.dash, solvedTimestamp: 1); final verticalWord = - ant.copyWith(mascot: Mascots.dino, solvedTimestamp: 1); + ant.copyWith(mascot: Mascot.dino, solvedTimestamp: 1); final letterData = CrosswordLetterData( index: (0, 0), chunkIndex: (0, 0), diff --git a/test/end_game/view/end_game_view_content_test.dart b/test/end_game/view/end_game_view_content_test.dart index 08eee723a..3c7b4a43a 100644 --- a/test/end_game/view/end_game_view_content_test.dart +++ b/test/end_game/view/end_game_view_content_test.dart @@ -204,10 +204,10 @@ void main() { playerBloc = _MockPlayerBloc(); }); - testWidgets('displays endGameDash image with ${Mascots.dash}', + testWidgets('displays endGameDash image with ${Mascot.dash}', (tester) async { when(() => playerBloc.state).thenReturn( - PlayerState(player: Player.empty.copyWith(mascot: Mascots.dash)), + PlayerState(player: Player.empty.copyWith(mascot: Mascot.dash)), ); await tester.pumpApp( @@ -222,10 +222,10 @@ void main() { ); }); - testWidgets('displays endGameDash image with ${Mascots.dino}', + testWidgets('displays endGameDash image with ${Mascot.dino}', (tester) async { when(() => playerBloc.state).thenReturn( - PlayerState(player: Player.empty.copyWith(mascot: Mascots.dino)), + PlayerState(player: Player.empty.copyWith(mascot: Mascot.dino)), ); await tester.pumpApp( @@ -242,10 +242,10 @@ void main() { ); }); - testWidgets('displays endGameDash image with ${Mascots.sparky}', + testWidgets('displays endGameDash image with ${Mascot.sparky}', (tester) async { when(() => playerBloc.state).thenReturn( - PlayerState(player: Player.empty.copyWith(mascot: Mascots.sparky)), + PlayerState(player: Player.empty.copyWith(mascot: Mascot.sparky)), ); await tester.pumpApp( @@ -262,10 +262,10 @@ void main() { ); }); - testWidgets('displays endGameDash image with ${Mascots.android}', + testWidgets('displays endGameDash image with ${Mascot.android}', (tester) async { when(() => playerBloc.state).thenReturn( - PlayerState(player: Player.empty.copyWith(mascot: Mascots.android)), + PlayerState(player: Player.empty.copyWith(mascot: Mascot.android)), ); await tester.pumpApp( diff --git a/test/extensions/mascot_color_test.dart b/test/extensions/mascot_color_test.dart index 31371c2b6..bd516de7a 100644 --- a/test/extensions/mascot_color_test.dart +++ b/test/extensions/mascot_color_test.dart @@ -8,23 +8,23 @@ import 'package:io_crossword_ui/io_crossword_ui.dart'; void main() { group('MascotColor', () { test('returns seedBlue for dash', () { - expect(Mascots.dash.color, IoCrosswordColors.flutterBlue); + expect(Mascot.dash.color, IoCrosswordColors.flutterBlue); }); test('returns seedYellow for sparky', () { - expect(Mascots.sparky.color, IoCrosswordColors.sparkyYellow); + expect(Mascot.sparky.color, IoCrosswordColors.sparkyYellow); }); test('returns accessibleGrey for dino', () { - expect(Mascots.dino.color, IoCrosswordColors.accessibleGrey); + expect(Mascot.dino.color, IoCrosswordColors.accessibleGrey); }); test('returns seedGreen for android', () { - expect(Mascots.android.color, IoCrosswordColors.androidGreen); + expect(Mascot.android.color, IoCrosswordColors.androidGreen); }); test('returns seedBlue when the mascot is not defined', () { - final Mascots? nullMascot = null; + final Mascot? nullMascot = null; expect(nullMascot.color, IoCrosswordColors.flutterBlue); }); }); diff --git a/test/how_to_play/cubit/how_to_play_cubit_test.dart b/test/how_to_play/cubit/how_to_play_cubit_test.dart index 6b66ef18e..fee1c8137 100644 --- a/test/how_to_play/cubit/how_to_play_cubit_test.dart +++ b/test/how_to_play/cubit/how_to_play_cubit_test.dart @@ -57,7 +57,7 @@ void main() { emitsInOrder(expectedStates), ); - cubit.loadAssets(Mascots.dash); + cubit.loadAssets(Mascot.dash); debugDefaultTargetPlatformOverride = null; }); @@ -76,7 +76,7 @@ void main() { emitsInOrder(expectedStates), ); - cubit.loadAssets(Mascots.dash); + cubit.loadAssets(Mascot.dash); debugDefaultTargetPlatformOverride = null; }); diff --git a/test/how_to_play/view/how_to_play_page_test.dart b/test/how_to_play/view/how_to_play_page_test.dart index d4244f8c8..704b5f8f0 100644 --- a/test/how_to_play/view/how_to_play_page_test.dart +++ b/test/how_to_play/view/how_to_play_page_test.dart @@ -33,11 +33,11 @@ void main() { setUp(() async { Flame.images = Images(prefix: ''); await Flame.images.loadAll([ - ...Mascots.dash.teamMascot.loadableHowToPlayDesktopAssets(), - ...Mascots.dash.teamMascot.loadableHowToPlayMobileAssets(), + ...Mascot.dash.teamMascot.loadableHowToPlayDesktopAssets(), + ...Mascot.dash.teamMascot.loadableHowToPlayMobileAssets(), ]); - registerFallbackValue(Mascots.dash); + registerFallbackValue(Mascot.dash); }); group('$HowToPlayPage', () { @@ -315,7 +315,7 @@ void main() { isA().having( (item) => item.spriteData, 'spriteData', - Mascots.dash.teamMascot.lookUpSpriteMobileData, + Mascot.dash.teamMascot.lookUpSpriteMobileData, ), ); diff --git a/test/how_to_play/widgets/how_to_play_content_test.dart b/test/how_to_play/widgets/how_to_play_content_test.dart index 493a25dcf..969ff9cd8 100644 --- a/test/how_to_play/widgets/how_to_play_content_test.dart +++ b/test/how_to_play/widgets/how_to_play_content_test.dart @@ -33,7 +33,7 @@ void main() { widget = BlocProvider.value( value: howToPlayCubit, child: HowToPlayContent( - mascot: Mascots.dash, + mascot: Mascot.dash, onDonePressed: () {}, ), ); @@ -283,7 +283,7 @@ void main() { (tester) async { when(() => howToPlayCubit.state).thenReturn(HowToPlayState()); - for (final mascot in Mascots.values) { + for (final mascot in Mascot.values) { await tester.pumpApp( BlocProvider.value( value: howToPlayCubit, @@ -307,7 +307,7 @@ void main() { (tester) async { when(() => howToPlayCubit.state).thenReturn(HowToPlayState(index: 1)); - for (final mascot in Mascots.values) { + for (final mascot in Mascot.values) { await tester.pumpApp( BlocProvider.value( value: howToPlayCubit, @@ -331,7 +331,7 @@ void main() { (tester) async { when(() => howToPlayCubit.state).thenReturn(HowToPlayState(index: 2)); - for (final mascot in Mascots.values) { + for (final mascot in Mascot.values) { await tester.pumpApp( BlocProvider.value( value: howToPlayCubit, diff --git a/test/how_to_play/widgets/play_now_button_test.dart b/test/how_to_play/widgets/play_now_button_test.dart index 984e97636..16aaf64f7 100644 --- a/test/how_to_play/widgets/play_now_button_test.dart +++ b/test/how_to_play/widgets/play_now_button_test.dart @@ -36,7 +36,7 @@ void main() { player: Player( id: '1', initials: 'AAA', - mascot: Mascots.dash, + mascot: Mascot.dash, ), ), ); diff --git a/test/leaderboard/bloc/leaderboard_bloc_test.dart b/test/leaderboard/bloc/leaderboard_bloc_test.dart index 26b74db02..784955afd 100644 --- a/test/leaderboard/bloc/leaderboard_bloc_test.dart +++ b/test/leaderboard/bloc/leaderboard_bloc_test.dart @@ -43,7 +43,7 @@ void main() { (index) => const Player( id: '', initials: 'AAA', - mascot: Mascots.dash, + mascot: Mascot.dash, ), ), ), @@ -62,21 +62,21 @@ void main() { initials: 'AAA', score: 100, streak: 20, - mascot: Mascots.dash, + mascot: Mascot.dash, ), Player( id: '2', initials: 'BBB', score: 80, streak: 10, - mascot: Mascots.android, + mascot: Mascot.android, ), Player( id: '3', initials: 'CCC', score: 60, streak: 5, - mascot: Mascots.sparky, + mascot: Mascot.sparky, ), ], ); @@ -94,21 +94,21 @@ void main() { initials: 'AAA', score: 100, streak: 20, - mascot: Mascots.dash, + mascot: Mascot.dash, ), Player( id: '2', initials: 'BBB', score: 80, streak: 10, - mascot: Mascots.android, + mascot: Mascot.android, ), Player( id: '3', initials: 'CCC', score: 60, streak: 5, - mascot: Mascots.sparky, + mascot: Mascot.sparky, ), ], ), diff --git a/test/leaderboard/bloc/leaderboard_state_test.dart b/test/leaderboard/bloc/leaderboard_state_test.dart index e3af740b6..8dabccd5d 100644 --- a/test/leaderboard/bloc/leaderboard_state_test.dart +++ b/test/leaderboard/bloc/leaderboard_state_test.dart @@ -23,7 +23,7 @@ void main() { initials: 'AAA', score: 100, streak: 2, - mascot: Mascots.dash, + mascot: Mascot.dash, ), ], ), @@ -48,7 +48,7 @@ void main() { initials: 'AAA', score: 100, streak: 2, - mascot: Mascots.dash, + mascot: Mascot.dash, ), ], ), @@ -60,7 +60,7 @@ void main() { initials: 'AAA', score: 100, streak: 2, - mascot: Mascots.dash, + mascot: Mascot.dash, ), ], ), diff --git a/test/leaderboard/view/leaderboard_success_test.dart b/test/leaderboard/view/leaderboard_success_test.dart index 49be35edc..e19ce7988 100644 --- a/test/leaderboard/view/leaderboard_success_test.dart +++ b/test/leaderboard/view/leaderboard_success_test.dart @@ -109,7 +109,7 @@ void main() { initials: 'BBB', score: 500, streak: 2, - mascot: Mascots.android, + mascot: Mascot.android, ); when(() => leaderboardBloc.state).thenReturn( @@ -121,7 +121,7 @@ void main() { initials: 'AAA', score: 50, streak: 2, - mascot: Mascots.dash, + mascot: Mascot.dash, ), )..insert(2, currentPlayer), ), @@ -157,7 +157,7 @@ void main() { initials: 'AAA', score: 50, streak: 20, - mascot: Mascots.dash, + mascot: Mascot.dash, ), ), ), @@ -192,7 +192,7 @@ void main() { initials: 'AAA', score: 50, streak: 2, - mascot: Mascots.dash, + mascot: Mascot.dash, ); when(() => playerBloc.state).thenReturn( @@ -217,7 +217,7 @@ void main() { initials: 'AAA', score: 50, streak: 2, - mascot: Mascots.dash, + mascot: Mascot.dash, ); when(() => playerBloc.state).thenReturn( @@ -268,7 +268,7 @@ void main() { initials: 'ABC', score: 200, streak: 2, - mascot: Mascots.dash, + mascot: Mascot.dash, ); setUpAll(() async { @@ -307,7 +307,7 @@ void main() { initials: 'ABC', score: 200, streak: 25, - mascot: Mascots.dash, + mascot: Mascot.dash, ); testWidgets( @@ -354,7 +354,7 @@ void main() { initials: 'ABC', score: 23700, streak: 2, - mascot: Mascots.dash, + mascot: Mascot.dash, ); await tester.pumpApp(CurrentUserPosition(player: player, rank: 4)); @@ -376,19 +376,19 @@ void main() { for (final mascot in [ _MascotTester( - mascot: Mascots.dash, + mascot: Mascot.dash, color: IoCrosswordColors.flutterBlue, ), _MascotTester( - mascot: Mascots.sparky, + mascot: Mascot.sparky, color: IoCrosswordColors.sparkyYellow, ), _MascotTester( - mascot: Mascots.dino, + mascot: Mascot.dino, color: IoCrosswordColors.chromeRed, ), _MascotTester( - mascot: Mascots.android, + mascot: Mascot.android, color: IoCrosswordColors.androidGreen, ), ]) { @@ -421,6 +421,6 @@ class _MascotTester { required this.color, }); - final Mascots mascot; + final Mascot mascot; final Color color; } diff --git a/test/player/bloc/player_bloc_test.dart b/test/player/bloc/player_bloc_test.dart index 23ca71fb9..01207eb12 100644 --- a/test/player/bloc/player_bloc_test.dart +++ b/test/player/bloc/player_bloc_test.dart @@ -21,7 +21,7 @@ void main() { const player = Player( id: 'user-id', - mascot: Mascots.android, + mascot: Mascot.android, streak: 5, initials: 'ABC', score: 1200, @@ -91,7 +91,7 @@ void main() { when( () => leaderboardResource.createScore( initials: 'AAA', - mascot: Mascots.dino, + mascot: Mascot.dino, ), ).thenAnswer((_) async {}); when( @@ -99,27 +99,27 @@ void main() { ).thenAnswer((_) => Stream.value((player, 3))); }, seed: () => PlayerState( - mascot: Mascots.dino, + mascot: Mascot.dino, player: Player( id: '1', initials: 'AAA', - mascot: Mascots.dino, + mascot: Mascot.dino, ), ), act: (bloc) => bloc.add(PlayerCreateScoreRequested('id')), expect: () => [ PlayerState( status: PlayerStatus.loading, - mascot: Mascots.dino, + mascot: Mascot.dino, player: Player( id: '1', initials: 'AAA', - mascot: Mascots.dino, + mascot: Mascot.dino, ), ), PlayerState( status: PlayerStatus.playing, - mascot: Mascots.dino, + mascot: Mascot.dino, player: player, rank: 3, ), @@ -127,7 +127,7 @@ void main() { verify: (bloc) => verify( () => leaderboardResource.createScore( initials: 'AAA', - mascot: Mascots.dino, + mascot: Mascot.dino, ), ).called(1), ); @@ -139,7 +139,7 @@ void main() { when( () => leaderboardResource.createScore( initials: 'AAA', - mascot: Mascots.dino, + mascot: Mascot.dino, ), ).thenAnswer((_) async {}); when( @@ -148,27 +148,27 @@ void main() { }, seed: () => PlayerState( status: PlayerStatus.playing, - mascot: Mascots.dino, + mascot: Mascot.dino, player: Player( id: '1', initials: 'AAA', - mascot: Mascots.dino, + mascot: Mascot.dino, ), ), act: (bloc) => bloc.add(PlayerCreateScoreRequested('id')), expect: () => [ PlayerState( status: PlayerStatus.loading, - mascot: Mascots.dino, + mascot: Mascot.dino, player: Player( id: '1', initials: 'AAA', - mascot: Mascots.dino, + mascot: Mascot.dino, ), ), PlayerState( status: PlayerStatus.playing, - mascot: Mascots.dino, + mascot: Mascot.dino, player: player, rank: 3, ), @@ -176,7 +176,7 @@ void main() { verify: (bloc) => verify( () => leaderboardResource.createScore( initials: 'AAA', - mascot: Mascots.dino, + mascot: Mascot.dino, ), ).called(1), ); @@ -188,36 +188,36 @@ void main() { when( () => leaderboardResource.createScore( initials: 'AAA', - mascot: Mascots.dino, + mascot: Mascot.dino, ), ).thenThrow(Exception()); }, seed: () => PlayerState( - mascot: Mascots.dino, + mascot: Mascot.dino, player: Player( id: '1', initials: 'AAA', - mascot: Mascots.dino, + mascot: Mascot.dino, ), ), act: (bloc) => bloc.add(PlayerCreateScoreRequested('id')), expect: () => [ PlayerState( status: PlayerStatus.loading, - mascot: Mascots.dino, + mascot: Mascot.dino, player: Player( id: '1', initials: 'AAA', - mascot: Mascots.dino, + mascot: Mascot.dino, ), ), PlayerState( status: PlayerStatus.failure, - mascot: Mascots.dino, + mascot: Mascot.dino, player: Player( id: '1', initials: 'AAA', - mascot: Mascots.dino, + mascot: Mascot.dino, ), ), ], @@ -229,11 +229,11 @@ void main() { build: () => bloc, seed: () => PlayerState( status: PlayerStatus.loading, - mascot: Mascots.dino, + mascot: Mascot.dino, player: Player( id: '1', initials: 'AAA', - mascot: Mascots.dino, + mascot: Mascot.dino, ), ), act: (bloc) => bloc.add(PlayerCreateScoreRequested('id')), @@ -244,11 +244,11 @@ void main() { 'when player initials are empty', build: () => bloc, seed: () => PlayerState( - mascot: Mascots.dino, + mascot: Mascot.dino, player: Player( id: '1', initials: '', - mascot: Mascots.dino, + mascot: Mascot.dino, ), ), act: (bloc) => bloc.add(PlayerCreateScoreRequested('id')), @@ -266,14 +266,14 @@ void main() { status: PlayerStatus.playing, rank: 50, ), - act: (bloc) => bloc.add(MascotSelected(Mascots.android)), + act: (bloc) => bloc.add(MascotSelected(Mascot.android)), expect: () => [ PlayerState( status: PlayerStatus.playing, rank: 50, - mascot: Mascots.android, + mascot: Mascot.android, player: Player.empty.copyWith( - mascot: Mascots.android, + mascot: Mascot.android, ), ), ], diff --git a/test/player/bloc/player_event_test.dart b/test/player/bloc/player_event_test.dart index 0207ba0b1..8a03cc24a 100644 --- a/test/player/bloc/player_event_test.dart +++ b/test/player/bloc/player_event_test.dart @@ -36,17 +36,17 @@ void main() { group('MascotSelected', () { test('can be instantiated', () { - expect(MascotSelected(Mascots.sparky), isA()); + expect(MascotSelected(Mascot.sparky), isA()); }); test('supports value comparisons', () { expect( - MascotSelected(Mascots.sparky), - equals(MascotSelected(Mascots.sparky)), + MascotSelected(Mascot.sparky), + equals(MascotSelected(Mascot.sparky)), ); expect( - MascotSelected(Mascots.sparky), - isNot(equals(MascotSelected(Mascots.dash))), + MascotSelected(Mascot.sparky), + isNot(equals(MascotSelected(Mascot.dash))), ); }); }); diff --git a/test/player/bloc/player_state_test.dart b/test/player/bloc/player_state_test.dart index a9300501f..cae5752fd 100644 --- a/test/player/bloc/player_state_test.dart +++ b/test/player/bloc/player_state_test.dart @@ -25,7 +25,7 @@ void main() { initials: 'AAA', score: 100, streak: 2, - mascot: Mascots.dash, + mascot: Mascot.dash, ), ), isNot(equals(PlayerState())), @@ -57,8 +57,8 @@ void main() { rank: 20, ); - final newState = state.copyWith(mascot: Mascots.dino); - expect(newState.mascot, equals(Mascots.dino)); + final newState = state.copyWith(mascot: Mascot.dino); + expect(newState.mascot, equals(Mascot.dino)); }); test('returns an instance with new initials', () { @@ -82,7 +82,7 @@ void main() { initials: 'AAA', score: 100, streak: 2, - mascot: Mascots.dash, + mascot: Mascot.dash, ), ), equals( @@ -92,7 +92,7 @@ void main() { initials: 'AAA', score: 100, streak: 2, - mascot: Mascots.dash, + mascot: Mascot.dash, ), ), ), diff --git a/test/player/view/player_ranking_information_test.dart b/test/player/view/player_ranking_information_test.dart index 759a5d207..0d3c7e824 100644 --- a/test/player/view/player_ranking_information_test.dart +++ b/test/player/view/player_ranking_information_test.dart @@ -65,7 +65,7 @@ void main() { initials: 'ABC', score: 200, streak: 10, - mascot: Mascots.sparky, + mascot: Mascot.sparky, ), rank: 50, ), @@ -87,7 +87,7 @@ void main() { initials: 'ABC', score: 200, streak: 10, - mascot: Mascots.sparky, + mascot: Mascot.sparky, ), rank: 50, ), @@ -109,7 +109,7 @@ void main() { initials: 'ABC', score: 200, streak: 10, - mascot: Mascots.sparky, + mascot: Mascot.sparky, ), rank: 50, ), diff --git a/test/share/widgets/share_image_test.dart b/test/share/widgets/share_image_test.dart index d2c2b8e92..ad77aa5a3 100644 --- a/test/share/widgets/share_image_test.dart +++ b/test/share/widgets/share_image_test.dart @@ -21,10 +21,9 @@ void main() { playerBloc = _MockPlayerBloc(); }); - testWidgets('displays shareDash image with ${Mascots.dash}', - (tester) async { + testWidgets('displays shareDash image with ${Mascot.dash}', (tester) async { when(() => playerBloc.state).thenReturn( - PlayerState(player: Player.empty.copyWith(mascot: Mascots.dash)), + PlayerState(player: Player.empty.copyWith(mascot: Mascot.dash)), ); await tester.pumpApp( @@ -39,10 +38,10 @@ void main() { ); }); - testWidgets('displays shareAndroid image with ${Mascots.dino}', + testWidgets('displays shareAndroid image with ${Mascot.dino}', (tester) async { when(() => playerBloc.state).thenReturn( - PlayerState(player: Player.empty.copyWith(mascot: Mascots.dino)), + PlayerState(player: Player.empty.copyWith(mascot: Mascot.dino)), ); await tester.pumpApp( @@ -59,10 +58,10 @@ void main() { ); }); - testWidgets('displays shareDino image with ${Mascots.sparky}', + testWidgets('displays shareDino image with ${Mascot.sparky}', (tester) async { when(() => playerBloc.state).thenReturn( - PlayerState(player: Player.empty.copyWith(mascot: Mascots.sparky)), + PlayerState(player: Player.empty.copyWith(mascot: Mascot.sparky)), ); await tester.pumpApp( @@ -79,10 +78,10 @@ void main() { ); }); - testWidgets('displays shareSparky image with ${Mascots.android}', + testWidgets('displays shareSparky image with ${Mascot.android}', (tester) async { when(() => playerBloc.state).thenReturn( - PlayerState(player: Player.empty.copyWith(mascot: Mascots.android)), + PlayerState(player: Player.empty.copyWith(mascot: Mascot.android)), ); await tester.pumpApp( diff --git a/test/team_selection/view/team_selection_page_test.dart b/test/team_selection/view/team_selection_page_test.dart index bcff2940a..f07487d7a 100644 --- a/test/team_selection/view/team_selection_page_test.dart +++ b/test/team_selection/view/team_selection_page_test.dart @@ -32,14 +32,14 @@ void main() { setUpAll(() async { Flame.images = Images(prefix: ''); await Flame.images.loadAll([ - Mascots.dash.teamMascot.idleAnimation.keyName, - Mascots.dash.teamMascot.platformAnimation.keyName, - Mascots.android.teamMascot.idleAnimation.keyName, - Mascots.android.teamMascot.platformAnimation.keyName, - Mascots.dino.teamMascot.idleAnimation.keyName, - Mascots.dino.teamMascot.platformAnimation.keyName, - Mascots.sparky.teamMascot.idleAnimation.keyName, - Mascots.sparky.teamMascot.platformAnimation.keyName, + Mascot.dash.teamMascot.idleAnimation.keyName, + Mascot.dash.teamMascot.platformAnimation.keyName, + Mascot.android.teamMascot.idleAnimation.keyName, + Mascot.android.teamMascot.platformAnimation.keyName, + Mascot.dino.teamMascot.idleAnimation.keyName, + Mascot.dino.teamMascot.platformAnimation.keyName, + Mascot.sparky.teamMascot.idleAnimation.keyName, + Mascot.sparky.teamMascot.platformAnimation.keyName, ]); }); @@ -63,7 +63,7 @@ void main() { expect(find.byType(TeamSelectionView), findsOneWidget); }); - for (final mascot in Mascots.values) { + for (final mascot in Mascot.values) { testWidgets('updates index to ${mascot.index} with $mascot', (tester) async { when(() => playerBloc.state).thenReturn(PlayerState(mascot: mascot)); @@ -134,10 +134,10 @@ void main() { }); } - for (final mascot in Mascots.values) { + for (final mascot in Mascot.values) { testWidgets( 'calls MascotSelected with $mascot with index ' - '${Mascots.values[mascot.index]}', (tester) async { + '${Mascot.values[mascot.index]}', (tester) async { when(() => teamSelectionCubit.state).thenReturn( TeamSelectionState( assetsStatus: AssetsLoadingStatus.success, @@ -340,10 +340,10 @@ void main() { await tester.pump(); await tester.tap( - find.byType(TeamSelectionMascot).at(Mascots.sparky.index), + find.byType(TeamSelectionMascot).at(Mascot.sparky.index), ); - verify(() => teamSelectionCubit.selectTeam(Mascots.sparky.index)) + verify(() => teamSelectionCubit.selectTeam(Mascot.sparky.index)) .called(1); addTearDown(tester.view.resetPhysicalSize); diff --git a/test/team_selection/widgets/team_selection_mascot_platform_test.dart b/test/team_selection/widgets/team_selection_mascot_platform_test.dart index 254e49d25..6f72f8062 100644 --- a/test/team_selection/widgets/team_selection_mascot_platform_test.dart +++ b/test/team_selection/widgets/team_selection_mascot_platform_test.dart @@ -15,14 +15,14 @@ void main() { setUpAll(() async { Flame.images = Images(prefix: ''); await Flame.images.loadAll([ - Mascots.dash.teamMascot.idleAnimation.keyName, - Mascots.dash.teamMascot.platformAnimation.keyName, - Mascots.android.teamMascot.idleAnimation.keyName, - Mascots.android.teamMascot.platformAnimation.keyName, - Mascots.dino.teamMascot.idleAnimation.keyName, - Mascots.dino.teamMascot.platformAnimation.keyName, - Mascots.sparky.teamMascot.idleAnimation.keyName, - Mascots.sparky.teamMascot.platformAnimation.keyName, + Mascot.dash.teamMascot.idleAnimation.keyName, + Mascot.dash.teamMascot.platformAnimation.keyName, + Mascot.android.teamMascot.idleAnimation.keyName, + Mascot.android.teamMascot.platformAnimation.keyName, + Mascot.dino.teamMascot.idleAnimation.keyName, + Mascot.dino.teamMascot.platformAnimation.keyName, + Mascot.sparky.teamMascot.idleAnimation.keyName, + Mascot.sparky.teamMascot.platformAnimation.keyName, ]); }); @@ -30,7 +30,7 @@ void main() { (tester) async { await tester.pumpApp( TeamSelectionMascotPlatform( - mascot: Mascots.sparky, + mascot: Mascot.sparky, selected: true, ), ); @@ -42,7 +42,7 @@ void main() { (tester) async { await tester.pumpApp( TeamSelectionMascotPlatform( - mascot: Mascots.sparky, + mascot: Mascot.sparky, selected: false, ), ); diff --git a/test/team_selection/widgets/team_selection_mascot_test.dart b/test/team_selection/widgets/team_selection_mascot_test.dart index cded6d5c8..3a6fb976f 100644 --- a/test/team_selection/widgets/team_selection_mascot_test.dart +++ b/test/team_selection/widgets/team_selection_mascot_test.dart @@ -14,19 +14,19 @@ void main() { setUpAll(() async { Flame.images = Images(prefix: ''); await Flame.images.loadAll([ - Mascots.dash.teamMascot.idleAnimation.keyName, - Mascots.dash.teamMascot.platformAnimation.keyName, - Mascots.android.teamMascot.idleAnimation.keyName, - Mascots.android.teamMascot.platformAnimation.keyName, - Mascots.dino.teamMascot.idleAnimation.keyName, - Mascots.dino.teamMascot.platformAnimation.keyName, - Mascots.sparky.teamMascot.idleAnimation.keyName, - Mascots.sparky.teamMascot.platformAnimation.keyName, + Mascot.dash.teamMascot.idleAnimation.keyName, + Mascot.dash.teamMascot.platformAnimation.keyName, + Mascot.android.teamMascot.idleAnimation.keyName, + Mascot.android.teamMascot.platformAnimation.keyName, + Mascot.dino.teamMascot.idleAnimation.keyName, + Mascot.dino.teamMascot.platformAnimation.keyName, + Mascot.sparky.teamMascot.idleAnimation.keyName, + Mascot.sparky.teamMascot.platformAnimation.keyName, ]); }); testWidgets('renders a SpriteAnimationWidget', (tester) async { - await tester.pumpApp(TeamSelectionMascot(Mascots.sparky)); + await tester.pumpApp(TeamSelectionMascot(Mascot.sparky)); expect(find.byType(SpriteAnimationWidget), findsOneWidget); }); diff --git a/test/word_focused/view/word_success_view_test.dart b/test/word_focused/view/word_success_view_test.dart index 3f6a6fc58..4e7855505 100644 --- a/test/word_focused/view/word_success_view_test.dart +++ b/test/word_focused/view/word_success_view_test.dart @@ -426,7 +426,7 @@ void main() { player: Player( id: 'id', initials: 'VGV', - mascot: Mascots.sparky, + mascot: Mascot.sparky, score: 100, streak: 5, ), diff --git a/test/word_focused/widgets/word_selection_top_bar_test.dart b/test/word_focused/widgets/word_selection_top_bar_test.dart index 0ab64d193..37e7019f6 100644 --- a/test/word_focused/widgets/word_selection_top_bar_test.dart +++ b/test/word_focused/widgets/word_selection_top_bar_test.dart @@ -40,7 +40,7 @@ class _UnsolvedFakeWord extends Fake implements Word { int? get solvedTimestamp => null; @override - Mascots? get mascot => null; + Mascot? get mascot => null; } class _SolvedFakeWord extends Fake implements Word { @@ -60,7 +60,7 @@ class _SolvedFakeWord extends Fake implements Word { int? get solvedTimestamp => 1; @override - Mascots? get mascot => Mascots.android; + Mascot? get mascot => Mascot.android; } void main() {