fix: fixing old tests

pull/151/head
alestiago 4 years ago
parent 59dd003e2c
commit b699e7a15d

@ -17,11 +17,23 @@ void main() {
group('BonusBallController', () { group('BonusBallController', () {
late Ball ball; late Ball ball;
late GameBloc gameBloc;
setUp(() { setUp(() {
ball = Ball(baseColor: const Color(0xFF00FFFF)); ball = Ball(baseColor: const Color(0xFF00FFFF));
gameBloc = MockGameBloc();
whenListen(
gameBloc,
const Stream<GameState>.empty(),
initialState: const GameState.initial(),
);
}); });
final flameBlocTester = FlameBlocTester(
gameBuilder: EmptyPinballGameTest.new,
blocBuilder: () => gameBloc,
);
test('can be instantiated', () { test('can be instantiated', () {
expect( expect(
BonusBallController(ball), BonusBallController(ball),
@ -29,9 +41,9 @@ void main() {
); );
}); });
flameTester.test( flameBlocTester.testGameWidget(
'lost removes ball', 'lost removes ball',
(game) async { setUp: (game, tester) async {
await game.add(ball); await game.add(ball);
final controller = BonusBallController(ball); final controller = BonusBallController(ball);
await ball.ensureAdd(controller); await ball.ensureAdd(controller);

@ -20,11 +20,8 @@ void main() {
final wall = MockBottomWall(); final wall = MockBottomWall();
final ballController = MockBallController(); final ballController = MockBallController();
final ball = MockControlledBall(); final ball = MockControlledBall();
final componentSet = MockComponentSet();
when(() => componentSet.whereType<BallController>()) when(() => ball.controller).thenReturn(ballController);
.thenReturn([ballController]);
when(() => ball.children).thenReturn(componentSet);
BottomWallBallContactCallback().begin(ball, wall, MockContact()); BottomWallBallContactCallback().begin(ball, wall, MockContact());

Loading…
Cancel
Save