From 9fdb9355376a500d78fdf50bc141fe29ab4f6469 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 4ecdb05b..e6b03c5f 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 1841d0a3..da736c27 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() { setUp: (game, tester) async { final multiballs = Multiballs(); await game.pump(multiballs); - expect(game.descendants(), contains(multiballs)); + }, + verify: (game, tester) async { + expect(game.descendants().whereType().length, equals(1)); }, );