fix: flkay tests (#362)

pull/358/head
Erick 2 years ago committed by alestiago
parent 7d648a02e5
commit 07b8a45dd7

@ -42,6 +42,9 @@ class _TestGame extends Forge2DGame {
AndroidAcres child, { AndroidAcres child, {
required GameBloc gameBloc, required GameBloc gameBloc,
}) async { }) async {
// Not needed once https://github.com/flame-engine/flame/issues/1607
// is fixed
await onLoad();
await ensureAdd( await ensureAdd(
FlameBlocProvider<GameBloc, GameState>.value( FlameBlocProvider<GameBloc, GameState>.value(
value: gameBloc, value: gameBloc,

@ -17,8 +17,11 @@ class _TestGame extends Forge2DGame {
]); ]);
} }
Future<void> pump(Multiballs child, {GameBloc? gameBloc}) { Future<void> pump(Multiballs child, {GameBloc? gameBloc}) async {
return ensureAdd( // Not needed once https://github.com/flame-engine/flame/issues/1607
// is fixed
await onLoad();
await ensureAdd(
FlameBlocProvider<GameBloc, GameState>.value( FlameBlocProvider<GameBloc, GameState>.value(
value: gameBloc ?? GameBloc(), value: gameBloc ?? GameBloc(),
children: [child], children: [child],
@ -38,7 +41,9 @@ void main() {
(game) async { (game) async {
final multiballs = Multiballs(); final multiballs = Multiballs();
await game.pump(multiballs); await game.pump(multiballs);
expect(game.descendants(), contains(multiballs)); },
verify: (game, tester) async {
expect(game.descendants().whereType<Multiballs>().length, equals(1));
}, },
); );

Loading…
Cancel
Save