From 18c12bce7d7aa785ed23c80a1f2b3d8f932895e6 Mon Sep 17 00:00:00 2001 From: RuiAlonso Date: Wed, 27 Apr 2022 15:17:39 +0200 Subject: [PATCH] refactor: use rounds instead of balls --- lib/game/view/widgets/round_count_display.dart | 4 +--- test/game/view/widgets/game_hud_test.dart | 2 ++ test/game/view/widgets/round_count_display_test.dart | 8 +++++--- test/game/view/widgets/score_view_test.dart | 4 +++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/game/view/widgets/round_count_display.dart b/lib/game/view/widgets/round_count_display.dart index 98776764..87ab7ba0 100644 --- a/lib/game/view/widgets/round_count_display.dart +++ b/lib/game/view/widgets/round_count_display.dart @@ -14,9 +14,7 @@ class RoundCountDisplay extends StatelessWidget { @override Widget build(BuildContext context) { final l10n = context.l10n; - // TODO(arturplaczek): refactor when GameState handle balls and rounds and - // select state.rounds property instead of state.ball - final balls = context.select((GameBloc bloc) => bloc.state.balls); + final balls = context.select((GameBloc bloc) => bloc.state.rounds); return Row( children: [ diff --git a/test/game/view/widgets/game_hud_test.dart b/test/game/view/widgets/game_hud_test.dart index f8307b05..36d49160 100644 --- a/test/game/view/widgets/game_hud_test.dart +++ b/test/game/view/widgets/game_hud_test.dart @@ -18,7 +18,9 @@ void main() { const initialState = GameState( score: 1000, + multiplier: 1, balls: 2, + rounds: 1, bonusHistory: [], ); diff --git a/test/game/view/widgets/round_count_display_test.dart b/test/game/view/widgets/round_count_display_test.dart index 8281ce83..5b9b4d0a 100644 --- a/test/game/view/widgets/round_count_display_test.dart +++ b/test/game/view/widgets/round_count_display_test.dart @@ -11,7 +11,9 @@ void main() { late GameBloc gameBloc; const initialState = GameState( score: 0, - balls: 3, + multiplier: 1, + balls: 1, + rounds: 3, bonusHistory: [], ); @@ -37,7 +39,7 @@ void main() { testWidgets('two active round indicator', (tester) async { final state = initialState.copyWith( - balls: 2, + rounds: 2, ); whenListen( gameBloc, @@ -68,7 +70,7 @@ void main() { testWidgets('one active round indicator', (tester) async { final state = initialState.copyWith( - balls: 1, + rounds: 1, ); whenListen( gameBloc, diff --git a/test/game/view/widgets/score_view_test.dart b/test/game/view/widgets/score_view_test.dart index 0d3af694..a8660331 100644 --- a/test/game/view/widgets/score_view_test.dart +++ b/test/game/view/widgets/score_view_test.dart @@ -15,7 +15,9 @@ void main() { const score = 123456789; const initialState = GameState( score: score, + multiplier: 1, balls: 1, + rounds: 1, bonusHistory: [], ); @@ -46,7 +48,7 @@ void main() { stateController.add( initialState.copyWith( - balls: 0, + rounds: 0, ), );