From c0e349f73a7d29c474e6c814c623f08bf084a6f6 Mon Sep 17 00:00:00 2001 From: alestiago Date: Wed, 13 Apr 2022 23:23:04 +0200 Subject: [PATCH] refactor: renamed GameBonus.word to GameBonus.googleWord --- lib/game/bloc/game_state.dart | 5 ++--- lib/game/components/google_word.dart | 2 +- test/game/bloc/game_bloc_test.dart | 6 +++--- test/game/bloc/game_event_test.dart | 6 +++--- test/game/bloc/game_state_test.dart | 2 +- test/game/components/google_word_test.dart | 4 ++-- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/game/bloc/game_state.dart b/lib/game/bloc/game_state.dart index 8473057d..aa1144c0 100644 --- a/lib/game/bloc/game_state.dart +++ b/lib/game/bloc/game_state.dart @@ -4,9 +4,8 @@ part of 'game_bloc.dart'; /// Defines bonuses that a player can gain during a PinballGame. enum GameBonus { - /// Bonus achieved when the user activate all of the bonus - /// letters on the board, forming the bonus word. - word, + /// Bonus achieved when the ball activates all Google letters. + googleWord, /// Bonus achieved when the user activates all dash nest bumpers. dashNest, diff --git a/lib/game/components/google_word.dart b/lib/game/components/google_word.dart index 19c98a5d..2809ecc1 100644 --- a/lib/game/components/google_word.dart +++ b/lib/game/components/google_word.dart @@ -61,7 +61,7 @@ class _GoogleWordController extends ComponentController final activatedBonus = _activatedLetters.length == 6; if (activatedBonus) { gameRef.audio.googleBonus(); - gameRef.read().add(const BonusActivated(GameBonus.word)); + gameRef.read().add(const BonusActivated(GameBonus.googleWord)); component.children.whereType().forEach( (letter) => letter.deactivate(), ); diff --git a/test/game/bloc/game_bloc_test.dart b/test/game/bloc/game_bloc_test.dart index 319237f4..e83c35d3 100644 --- a/test/game/bloc/game_bloc_test.dart +++ b/test/game/bloc/game_bloc_test.dart @@ -123,20 +123,20 @@ void main() { 'adds bonus to history', build: GameBloc.new, act: (bloc) => bloc - ..add(const BonusActivated(GameBonus.word)) + ..add(const BonusActivated(GameBonus.googleWord)) ..add(const BonusActivated(GameBonus.dashNest)), expect: () => const [ GameState( score: 0, balls: 3, activatedDashNests: {}, - bonusHistory: [GameBonus.word], + bonusHistory: [GameBonus.googleWord], ), GameState( score: 0, balls: 3, activatedDashNests: {}, - bonusHistory: [GameBonus.word, GameBonus.dashNest], + bonusHistory: [GameBonus.googleWord, GameBonus.dashNest], ), ], ); diff --git a/test/game/bloc/game_event_test.dart b/test/game/bloc/game_event_test.dart index 7f67daa8..ef2a9f54 100644 --- a/test/game/bloc/game_event_test.dart +++ b/test/game/bloc/game_event_test.dart @@ -48,11 +48,11 @@ void main() { test('supports value equality', () { expect( - BonusActivated(GameBonus.word), - equals(const BonusActivated(GameBonus.word)), + BonusActivated(GameBonus.googleWord), + equals(const BonusActivated(GameBonus.googleWord)), ); expect( - const BonusActivated(GameBonus.word), + const BonusActivated(GameBonus.googleWord), isNot(equals(const BonusActivated(GameBonus.dashNest))), ); }); diff --git a/test/game/bloc/game_state_test.dart b/test/game/bloc/game_state_test.dart index fd97125c..81ca29f1 100644 --- a/test/game/bloc/game_state_test.dart +++ b/test/game/bloc/game_state_test.dart @@ -145,7 +145,7 @@ void main() { score: gameState.score + 1, balls: gameState.balls + 1, activatedDashNests: const {'1'}, - bonusHistory: const [GameBonus.word], + bonusHistory: const [GameBonus.googleWord], ); expect(gameState, isNot(equals(otherGameState))); diff --git a/test/game/components/google_word_test.dart b/test/game/components/google_word_test.dart index 87744de4..3974c7ba 100644 --- a/test/game/components/google_word_test.dart +++ b/test/game/components/google_word_test.dart @@ -59,11 +59,11 @@ void main() { if (letter == letters.last) { verify( - () => gameBloc.add(const BonusActivated(GameBonus.word)), + () => gameBloc.add(const BonusActivated(GameBonus.googleWord)), ).called(1); } else { verifyNever( - () => gameBloc.add(const BonusActivated(GameBonus.word)), + () => gameBloc.add(const BonusActivated(GameBonus.googleWord)), ); } }