From 07b8a45dd75165979af31aa276ffcb0008db3c73 Mon Sep 17 00:00:00 2001 From: Erick Date: Fri, 6 May 2022 12:11:48 -0300 Subject: [PATCH] fix: flkay tests (#362) --- .../android_spaceship_bonus_behavior_test.dart | 3 +++ test/game/components/multiballs/multiballs_test.dart | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/test/game/components/android_acres/behaviors/android_spaceship_bonus_behavior_test.dart b/test/game/components/android_acres/behaviors/android_spaceship_bonus_behavior_test.dart index 99606f22..b9345c27 100644 --- a/test/game/components/android_acres/behaviors/android_spaceship_bonus_behavior_test.dart +++ b/test/game/components/android_acres/behaviors/android_spaceship_bonus_behavior_test.dart @@ -42,6 +42,9 @@ class _TestGame extends Forge2DGame { AndroidAcres child, { required GameBloc gameBloc, }) async { + // Not needed once https://github.com/flame-engine/flame/issues/1607 + // is fixed + await onLoad(); await ensureAdd( FlameBlocProvider.value( value: gameBloc, diff --git a/test/game/components/multiballs/multiballs_test.dart b/test/game/components/multiballs/multiballs_test.dart index 125330f7..1f175e7a 100644 --- a/test/game/components/multiballs/multiballs_test.dart +++ b/test/game/components/multiballs/multiballs_test.dart @@ -17,8 +17,11 @@ class _TestGame extends Forge2DGame { ]); } - Future pump(Multiballs child, {GameBloc? gameBloc}) { - return ensureAdd( + Future pump(Multiballs child, {GameBloc? gameBloc}) async { + // Not needed once https://github.com/flame-engine/flame/issues/1607 + // is fixed + await onLoad(); + await ensureAdd( FlameBlocProvider.value( value: gameBloc ?? GameBloc(), children: [child], @@ -38,7 +41,9 @@ void main() { (game) async { final multiballs = Multiballs(); await game.pump(multiballs); - expect(game.descendants(), contains(multiballs)); + }, + verify: (game, tester) async { + expect(game.descendants().whereType().length, equals(1)); }, );