From b699e7a15d551eb1556cbb59f0f156a638c1f130 Mon Sep 17 00:00:00 2001 From: alestiago Date: Wed, 6 Apr 2022 09:32:52 +0100 Subject: [PATCH] fix: fixing old tests --- test/game/components/controlled_ball_test.dart | 16 ++++++++++++++-- test/game/components/wall_test.dart | 5 +---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/test/game/components/controlled_ball_test.dart b/test/game/components/controlled_ball_test.dart index 84de8c64..8b77f19d 100644 --- a/test/game/components/controlled_ball_test.dart +++ b/test/game/components/controlled_ball_test.dart @@ -17,11 +17,23 @@ void main() { group('BonusBallController', () { late Ball ball; + late GameBloc gameBloc; setUp(() { ball = Ball(baseColor: const Color(0xFF00FFFF)); + gameBloc = MockGameBloc(); + whenListen( + gameBloc, + const Stream.empty(), + initialState: const GameState.initial(), + ); }); + final flameBlocTester = FlameBlocTester( + gameBuilder: EmptyPinballGameTest.new, + blocBuilder: () => gameBloc, + ); + test('can be instantiated', () { expect( BonusBallController(ball), @@ -29,9 +41,9 @@ void main() { ); }); - flameTester.test( + flameBlocTester.testGameWidget( 'lost removes ball', - (game) async { + setUp: (game, tester) async { await game.add(ball); final controller = BonusBallController(ball); await ball.ensureAdd(controller); diff --git a/test/game/components/wall_test.dart b/test/game/components/wall_test.dart index f280b9a8..cf9d5480 100644 --- a/test/game/components/wall_test.dart +++ b/test/game/components/wall_test.dart @@ -20,11 +20,8 @@ void main() { final wall = MockBottomWall(); final ballController = MockBallController(); final ball = MockControlledBall(); - final componentSet = MockComponentSet(); - when(() => componentSet.whereType()) - .thenReturn([ballController]); - when(() => ball.children).thenReturn(componentSet); + when(() => ball.controller).thenReturn(ballController); BottomWallBallContactCallback().begin(ball, wall, MockContact());