diff --git a/packages/pinball_audio/test/src/pinball_audio_test.dart b/packages/pinball_audio/test/src/pinball_audio_test.dart index b7e38554..47d788bf 100644 --- a/packages/pinball_audio/test/src/pinball_audio_test.dart +++ b/packages/pinball_audio/test/src/pinball_audio_test.dart @@ -102,7 +102,9 @@ void main() { group('load', () { test('creates the bumpers pools', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); verify( () => createAudioPool.onCall( @@ -122,7 +124,9 @@ void main() { }); test('creates the kicker pools', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); verify( () => createAudioPool.onCall( @@ -142,7 +146,9 @@ void main() { }); test('configures the audio cache instance', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); verify(() => configureAudioCache.onCall(FlameAudio.audioCache)) .called(1); @@ -154,13 +160,17 @@ void main() { playSingleAudio: playSingleAudio.onCall, preCacheSingleAudio: preCacheSingleAudio.onCall, ); - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); expect(FlameAudio.audioCache.prefix, equals('')); }); test('pre cache the assets', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); verify( () => preCacheSingleAudio @@ -242,7 +252,9 @@ void main() { group('when seed is true', () { test('plays the bumper A sound pool', () async { when(seed.nextBool).thenReturn(true); - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.bumper); verify(() => bumperAPool.start(volume: 0.6)).called(1); @@ -252,7 +264,9 @@ void main() { group('when seed is false', () { test('plays the bumper B sound pool', () async { when(seed.nextBool).thenReturn(false); - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.bumper); verify(() => bumperBPool.start(volume: 0.6)).called(1); @@ -291,7 +305,9 @@ void main() { group('when seed is true', () { test('plays the kicker A sound pool', () async { when(seed.nextBool).thenReturn(true); - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.kicker); verify(() => kickerAPool.start(volume: 0.6)).called(1); @@ -301,7 +317,9 @@ void main() { group('when seed is false', () { test('plays the kicker B sound pool', () async { when(seed.nextBool).thenReturn(false); - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.kicker); verify(() => kickerBPool.start(volume: 0.6)).called(1); @@ -311,7 +329,9 @@ void main() { group('cow moo', () { test('plays the correct file', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.cowMoo); verify( @@ -324,7 +344,9 @@ void main() { final clock = _MockClock(); await withClock(clock, () async { when(clock.now).thenReturn(DateTime(2022)); - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer ..play(PinballAudio.cowMoo) ..play(PinballAudio.cowMoo); @@ -347,7 +369,9 @@ void main() { group('google', () { test('plays the correct file', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.google); verify( @@ -361,7 +385,9 @@ void main() { group('sparky', () { test('plays the correct file', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.sparky); verify( @@ -375,7 +401,9 @@ void main() { group('dino', () { test('plays the correct file', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.dino); verify( @@ -389,7 +417,9 @@ void main() { group('android', () { test('plays the correct file', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.android); verify( @@ -403,7 +433,9 @@ void main() { group('dash', () { test('plays the correct file', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.dash); verify( @@ -417,7 +449,9 @@ void main() { group('launcher', () { test('plays the correct file', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.launcher); verify( @@ -431,7 +465,9 @@ void main() { group('rollover', () { test('plays the correct file', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.rollover); verify( @@ -445,7 +481,9 @@ void main() { group('ioPinballVoiceOver', () { test('plays the correct file', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.ioPinballVoiceOver); verify( @@ -459,7 +497,9 @@ void main() { group('gameOverVoiceOver', () { test('plays the correct file', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.gameOverVoiceOver); verify( @@ -473,7 +513,9 @@ void main() { group('backgroundMusic', () { test('plays the correct file', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer.play(PinballAudio.backgroundMusic); verify( @@ -485,7 +527,9 @@ void main() { }); test('plays only once', () async { - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); audioPlayer ..play(PinballAudio.backgroundMusic) ..play(PinballAudio.backgroundMusic); @@ -503,7 +547,9 @@ void main() { 'throws assertions error when playing an unregistered audio', () async { audioPlayer.audios.remove(PinballAudio.google); - await Future.wait(audioPlayer.load().map((e) => e())); + await Future.wait( + audioPlayer.load().map((loadableBuilder) => loadableBuilder()), + ); expect( () => audioPlayer.play(PinballAudio.google), diff --git a/test/game/pinball_game_test.dart b/test/game/pinball_game_test.dart index d0e79652..61e0db30 100644 --- a/test/game/pinball_game_test.dart +++ b/test/game/pinball_game_test.dart @@ -35,7 +35,7 @@ class _TestPinballGame extends PinballGame { @override Future onLoad() async { images.prefix = ''; - final futures = preLoadAssets().map((e) => e()); + final futures = preLoadAssets().map((loadableBuilder) => loadableBuilder()); await Future.wait(futures); await super.onLoad(); } @@ -56,7 +56,7 @@ class _TestDebugPinballGame extends DebugPinballGame { @override Future onLoad() async { images.prefix = ''; - final futures = preLoadAssets().map((e) => e()); + final futures = preLoadAssets().map((loadableBuilder) => loadableBuilder()); await Future.wait(futures); await super.onLoad(); } @@ -215,7 +215,8 @@ void main() { 'paints sprites with FilterQuality.medium', setUp: (game, tester) async { game.images.prefix = ''; - final futures = game.preLoadAssets().map((e) => e()); + final futures = + game.preLoadAssets().map((loadableBuilder) => loadableBuilder()); await Future.wait(futures); await game.ready(); diff --git a/test/game/view/pinball_game_page_test.dart b/test/game/view/pinball_game_page_test.dart index 7aa5fc68..da52bbd0 100644 --- a/test/game/view/pinball_game_page_test.dart +++ b/test/game/view/pinball_game_page_test.dart @@ -41,7 +41,9 @@ class _TestPinballGame extends PinballGame { ...SelectedCharacter.loadAssets(), preFetchLeaderboard, ]; - await Future.wait(futures.map((e) => e()).toList()); + await Future.wait( + futures.map((loadableBuilder) => loadableBuilder()).toList(), + ); return super.onLoad(); } @@ -80,7 +82,9 @@ void main() { late GameBloc gameBloc; setUp(() async { - await Future.wait(game.preLoadAssets().map((e) => e())); + await Future.wait( + game.preLoadAssets().map((loadableBuilder) => loadableBuilder()), + ); characterThemeCubit = _MockCharacterThemeCubit(); gameBloc = _MockGameBloc(); @@ -181,7 +185,9 @@ void main() { final startGameBloc = _MockStartGameBloc(); setUp(() async { - await Future.wait(game.preLoadAssets().map((e) => e())); + await Future.wait( + game.preLoadAssets().map((loadableBuilder) => loadableBuilder()), + ); whenListen( gameBloc,