Fixes some more async test issues

pull/505/head
Alvaro Almeida Freire Stivi 1 year ago
parent 1e5cc0cf4d
commit 3ae8a0c36b
No known key found for this signature in database

@ -655,6 +655,7 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'adds LeaderboardDisplay on LeaderboardSuccessState', 'adds LeaderboardDisplay on LeaderboardSuccessState',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
whenListen( whenListen(
bloc, bloc,
Stream<BackboxState>.empty(), Stream<BackboxState>.empty(),
@ -669,6 +670,7 @@ void main() {
backbox, backbox,
platformHelper: platformHelper, platformHelper: platformHelper,
); );
await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
expect( expect(
@ -681,6 +683,7 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'adds LeaderboardFailureDisplay on LeaderboardFailureState', 'adds LeaderboardFailureDisplay on LeaderboardFailureState',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
whenListen( whenListen(
bloc, bloc,
Stream<BackboxState>.empty(), Stream<BackboxState>.empty(),
@ -695,6 +698,7 @@ void main() {
backbox, backbox,
platformHelper: platformHelper, platformHelper: platformHelper,
); );
await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
expect( expect(

@ -33,6 +33,7 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'loads correctly', 'loads correctly',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final bottomGroup = BottomGroup(); final bottomGroup = BottomGroup();
await game.ensureAdd( await game.ensureAdd(
FlameBlocProvider<GameBloc, GameState>.value( FlameBlocProvider<GameBloc, GameState>.value(
@ -40,6 +41,7 @@ void main() {
children: [bottomGroup], children: [bottomGroup],
), ),
); );
await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
expect(game.descendants().whereType<BottomGroup>().length, equals(1)); expect(game.descendants().whereType<BottomGroup>().length, equals(1));
@ -50,6 +52,7 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'one left flipper', 'one left flipper',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final bottomGroup = BottomGroup(); final bottomGroup = BottomGroup();
await game.ensureAdd( await game.ensureAdd(
FlameBlocProvider<GameBloc, GameState>.value( FlameBlocProvider<GameBloc, GameState>.value(
@ -76,6 +79,7 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'one right flipper', 'one right flipper',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final bottomGroup = BottomGroup(); final bottomGroup = BottomGroup();
await game.ensureAdd( await game.ensureAdd(
FlameBlocProvider<GameBloc, GameState>.value( FlameBlocProvider<GameBloc, GameState>.value(
@ -102,6 +106,7 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'two Baseboards', 'two Baseboards',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final bottomGroup = BottomGroup(); final bottomGroup = BottomGroup();
await game.ensureAdd( await game.ensureAdd(
FlameBlocProvider<GameBloc, GameState>.value( FlameBlocProvider<GameBloc, GameState>.value(
@ -123,6 +128,7 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'two Kickers', 'two Kickers',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final bottomGroup = BottomGroup(); final bottomGroup = BottomGroup();
await game.ensureAdd( await game.ensureAdd(
FlameBlocProvider<GameBloc, GameState>.value( FlameBlocProvider<GameBloc, GameState>.value(

Loading…
Cancel
Save