diff --git a/lib/game/bloc/game_event.dart b/lib/game/bloc/game_event.dart index d177eb6a..39f7260b 100644 --- a/lib/game/bloc/game_event.dart +++ b/lib/game/bloc/game_event.dart @@ -65,25 +65,3 @@ class MultiplierIncreased extends GameEvent { @override List get props => []; } - -/// {@template multiplier_applied_game_event} -/// Event added when multiplier is applied to score. -/// {@endtemplate} -class MultiplierApplied extends GameEvent { - /// {@macro multiplier_applied_game_event} - const MultiplierApplied(); - - @override - List get props => []; -} - -/// {@template multiplier_reset_game_event} -/// Event added when multiplier is reset. -/// {@endtemplate} -class MultiplierReset extends GameEvent { - /// {@macro multiplier_reset_game_event} - const MultiplierReset(); - - @override - List get props => []; -} diff --git a/test/game/bloc/game_bloc_test.dart b/test/game/bloc/game_bloc_test.dart index 8223acd8..02752b07 100644 --- a/test/game/bloc/game_bloc_test.dart +++ b/test/game/bloc/game_bloc_test.dart @@ -28,6 +28,48 @@ void main() { ), ], ); + + blocTest( + 'apply multiplier to score ' + 'when round is lost', + build: GameBloc.new, + seed: () => const GameState( + score: 5, + multiplier: 3, + balls: 1, + rounds: 2, + bonusHistory: [], + ), + act: (bloc) { + bloc.add(const BallLost(balls: 0)); + }, + expect: () => [ + isA() + ..having((state) => state.score, 'score', 15) + ..having((state) => state.rounds, 'rounds', 1), + ], + ); + + blocTest( + 'resets multiplier ' + 'when round is lost', + build: GameBloc.new, + seed: () => const GameState( + score: 5, + multiplier: 3, + balls: 1, + rounds: 2, + bonusHistory: [], + ), + act: (bloc) { + bloc.add(const BallLost(balls: 0)); + }, + expect: () => [ + isA() + ..having((state) => state.multiplier, 'multiplier', 1) + ..having((state) => state.rounds, 'rounds', 1), + ], + ); }); group('Scored', () { @@ -84,7 +126,7 @@ void main() { const GameState( score: 0, multiplier: 1, - balls: 0, + balls: 1, rounds: 0, bonusHistory: [], ), @@ -154,57 +196,6 @@ void main() { ); }); - group('MultiplierApplied', () { - blocTest( - 'apply multiplier to score', - build: GameBloc.new, - seed: () => const GameState( - score: 5, - multiplier: 3, - balls: 2, - rounds: 2, - bonusHistory: [], - ), - act: (bloc) { - bloc.add(const MultiplierApplied()); - }, - expect: () => [ - const GameState( - score: 15, - multiplier: 3, - balls: 2, - rounds: 2, - bonusHistory: [], - ), - ], - ); - }); - - group('MultiplierReset', () { - blocTest( - 'resets multiplier', - build: GameBloc.new, - seed: () => const GameState( - score: 0, - multiplier: 3, - balls: 2, - rounds: 2, - bonusHistory: [], - ), - act: (bloc) { - bloc.add(const MultiplierReset()); - }, - expect: () => [ - const GameState( - score: 0, - multiplier: 1, - balls: 2, - rounds: 2, - bonusHistory: [], - ), - ], - ); - }); group( 'BonusActivated', () { @@ -218,15 +209,15 @@ void main() { GameState( score: 0, multiplier: 1, - balls: 3, - rounds: 2, + balls: 1, + rounds: 3, bonusHistory: [GameBonus.googleWord], ), GameState( score: 0, multiplier: 1, - balls: 3, - rounds: 2, + balls: 1, + rounds: 3, bonusHistory: [GameBonus.googleWord, GameBonus.dashNest], ), ], diff --git a/test/game/bloc/game_event_test.dart b/test/game/bloc/game_event_test.dart index 067b95a0..61fca87d 100644 --- a/test/game/bloc/game_event_test.dart +++ b/test/game/bloc/game_event_test.dart @@ -58,32 +58,6 @@ void main() { }); }); - group('MultiplierApplied', () { - test('can be instantiated', () { - expect(const MultiplierApplied(), isNotNull); - }); - - test('supports value equality', () { - expect( - MultiplierApplied(), - equals(const MultiplierApplied()), - ); - }); - }); - - group('MultiplierReset', () { - test('can be instantiated', () { - expect(const MultiplierReset(), isNotNull); - }); - - test('supports value equality', () { - expect( - MultiplierReset(), - equals(const MultiplierReset()), - ); - }); - }); - group('BonusActivated', () { test('can be instantiated', () { expect(const BonusActivated(GameBonus.dashNest), isNotNull);