chore: remove instances of e

pull/443/head
Allison Ryan 3 years ago
parent 53c5a2a766
commit fd6cb0cd3a

@ -102,7 +102,9 @@ void main() {
group('load', () { group('load', () {
test('creates the bumpers pools', () async { test('creates the bumpers pools', () async {
await Future.wait(audioPlayer.load().map((e) => e())); await Future.wait(
audioPlayer.load().map((loadableBuilder) => loadableBuilder()),
);
verify( verify(
() => createAudioPool.onCall( () => createAudioPool.onCall(
@ -122,7 +124,9 @@ void main() {
}); });
test('creates the kicker pools', () async { test('creates the kicker pools', () async {
await Future.wait(audioPlayer.load().map((e) => e())); await Future.wait(
audioPlayer.load().map((loadableBuilder) => loadableBuilder()),
);
verify( verify(
() => createAudioPool.onCall( () => createAudioPool.onCall(
@ -142,7 +146,9 @@ void main() {
}); });
test('configures the audio cache instance', () async { 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)) verify(() => configureAudioCache.onCall(FlameAudio.audioCache))
.called(1); .called(1);
@ -154,13 +160,17 @@ void main() {
playSingleAudio: playSingleAudio.onCall, playSingleAudio: playSingleAudio.onCall,
preCacheSingleAudio: preCacheSingleAudio.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('')); expect(FlameAudio.audioCache.prefix, equals(''));
}); });
test('pre cache the assets', () async { test('pre cache the assets', () async {
await Future.wait(audioPlayer.load().map((e) => e())); await Future.wait(
audioPlayer.load().map((loadableBuilder) => loadableBuilder()),
);
verify( verify(
() => preCacheSingleAudio () => preCacheSingleAudio
@ -242,7 +252,9 @@ void main() {
group('when seed is true', () { group('when seed is true', () {
test('plays the bumper A sound pool', () async { test('plays the bumper A sound pool', () async {
when(seed.nextBool).thenReturn(true); 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); audioPlayer.play(PinballAudio.bumper);
verify(() => bumperAPool.start(volume: 0.6)).called(1); verify(() => bumperAPool.start(volume: 0.6)).called(1);
@ -252,7 +264,9 @@ void main() {
group('when seed is false', () { group('when seed is false', () {
test('plays the bumper B sound pool', () async { test('plays the bumper B sound pool', () async {
when(seed.nextBool).thenReturn(false); 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); audioPlayer.play(PinballAudio.bumper);
verify(() => bumperBPool.start(volume: 0.6)).called(1); verify(() => bumperBPool.start(volume: 0.6)).called(1);
@ -291,7 +305,9 @@ void main() {
group('when seed is true', () { group('when seed is true', () {
test('plays the kicker A sound pool', () async { test('plays the kicker A sound pool', () async {
when(seed.nextBool).thenReturn(true); 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); audioPlayer.play(PinballAudio.kicker);
verify(() => kickerAPool.start(volume: 0.6)).called(1); verify(() => kickerAPool.start(volume: 0.6)).called(1);
@ -301,7 +317,9 @@ void main() {
group('when seed is false', () { group('when seed is false', () {
test('plays the kicker B sound pool', () async { test('plays the kicker B sound pool', () async {
when(seed.nextBool).thenReturn(false); 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); audioPlayer.play(PinballAudio.kicker);
verify(() => kickerBPool.start(volume: 0.6)).called(1); verify(() => kickerBPool.start(volume: 0.6)).called(1);
@ -311,7 +329,9 @@ void main() {
group('cow moo', () { group('cow moo', () {
test('plays the correct file', () async { 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); audioPlayer.play(PinballAudio.cowMoo);
verify( verify(
@ -324,7 +344,9 @@ void main() {
final clock = _MockClock(); final clock = _MockClock();
await withClock(clock, () async { await withClock(clock, () async {
when(clock.now).thenReturn(DateTime(2022)); when(clock.now).thenReturn(DateTime(2022));
await Future.wait(audioPlayer.load().map((e) => e())); await Future.wait(
audioPlayer.load().map((loadableBuilder) => loadableBuilder()),
);
audioPlayer audioPlayer
..play(PinballAudio.cowMoo) ..play(PinballAudio.cowMoo)
..play(PinballAudio.cowMoo); ..play(PinballAudio.cowMoo);
@ -347,7 +369,9 @@ void main() {
group('google', () { group('google', () {
test('plays the correct file', () async { 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); audioPlayer.play(PinballAudio.google);
verify( verify(
@ -361,7 +385,9 @@ void main() {
group('sparky', () { group('sparky', () {
test('plays the correct file', () async { 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); audioPlayer.play(PinballAudio.sparky);
verify( verify(
@ -375,7 +401,9 @@ void main() {
group('dino', () { group('dino', () {
test('plays the correct file', () async { 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); audioPlayer.play(PinballAudio.dino);
verify( verify(
@ -389,7 +417,9 @@ void main() {
group('android', () { group('android', () {
test('plays the correct file', () async { 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); audioPlayer.play(PinballAudio.android);
verify( verify(
@ -403,7 +433,9 @@ void main() {
group('dash', () { group('dash', () {
test('plays the correct file', () async { 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); audioPlayer.play(PinballAudio.dash);
verify( verify(
@ -417,7 +449,9 @@ void main() {
group('launcher', () { group('launcher', () {
test('plays the correct file', () async { 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); audioPlayer.play(PinballAudio.launcher);
verify( verify(
@ -431,7 +465,9 @@ void main() {
group('rollover', () { group('rollover', () {
test('plays the correct file', () async { 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); audioPlayer.play(PinballAudio.rollover);
verify( verify(
@ -445,7 +481,9 @@ void main() {
group('ioPinballVoiceOver', () { group('ioPinballVoiceOver', () {
test('plays the correct file', () async { 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); audioPlayer.play(PinballAudio.ioPinballVoiceOver);
verify( verify(
@ -459,7 +497,9 @@ void main() {
group('gameOverVoiceOver', () { group('gameOverVoiceOver', () {
test('plays the correct file', () async { 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); audioPlayer.play(PinballAudio.gameOverVoiceOver);
verify( verify(
@ -473,7 +513,9 @@ void main() {
group('backgroundMusic', () { group('backgroundMusic', () {
test('plays the correct file', () async { 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); audioPlayer.play(PinballAudio.backgroundMusic);
verify( verify(
@ -485,7 +527,9 @@ void main() {
}); });
test('plays only once', () async { test('plays only once', () async {
await Future.wait(audioPlayer.load().map((e) => e())); await Future.wait(
audioPlayer.load().map((loadableBuilder) => loadableBuilder()),
);
audioPlayer audioPlayer
..play(PinballAudio.backgroundMusic) ..play(PinballAudio.backgroundMusic)
..play(PinballAudio.backgroundMusic); ..play(PinballAudio.backgroundMusic);
@ -503,7 +547,9 @@ void main() {
'throws assertions error when playing an unregistered audio', 'throws assertions error when playing an unregistered audio',
() async { () async {
audioPlayer.audios.remove(PinballAudio.google); audioPlayer.audios.remove(PinballAudio.google);
await Future.wait(audioPlayer.load().map((e) => e())); await Future.wait(
audioPlayer.load().map((loadableBuilder) => loadableBuilder()),
);
expect( expect(
() => audioPlayer.play(PinballAudio.google), () => audioPlayer.play(PinballAudio.google),

@ -35,7 +35,7 @@ class _TestPinballGame extends PinballGame {
@override @override
Future<void> onLoad() async { Future<void> onLoad() async {
images.prefix = ''; images.prefix = '';
final futures = preLoadAssets().map((e) => e()); final futures = preLoadAssets().map((loadableBuilder) => loadableBuilder());
await Future.wait<void>(futures); await Future.wait<void>(futures);
await super.onLoad(); await super.onLoad();
} }
@ -56,7 +56,7 @@ class _TestDebugPinballGame extends DebugPinballGame {
@override @override
Future<void> onLoad() async { Future<void> onLoad() async {
images.prefix = ''; images.prefix = '';
final futures = preLoadAssets().map((e) => e()); final futures = preLoadAssets().map((loadableBuilder) => loadableBuilder());
await Future.wait<void>(futures); await Future.wait<void>(futures);
await super.onLoad(); await super.onLoad();
} }
@ -215,7 +215,8 @@ void main() {
'paints sprites with FilterQuality.medium', 'paints sprites with FilterQuality.medium',
setUp: (game, tester) async { setUp: (game, tester) async {
game.images.prefix = ''; game.images.prefix = '';
final futures = game.preLoadAssets().map((e) => e()); final futures =
game.preLoadAssets().map((loadableBuilder) => loadableBuilder());
await Future.wait<void>(futures); await Future.wait<void>(futures);
await game.ready(); await game.ready();

@ -41,7 +41,9 @@ class _TestPinballGame extends PinballGame {
...SelectedCharacter.loadAssets(), ...SelectedCharacter.loadAssets(),
preFetchLeaderboard, preFetchLeaderboard,
]; ];
await Future.wait<void>(futures.map((e) => e()).toList()); await Future.wait<void>(
futures.map((loadableBuilder) => loadableBuilder()).toList(),
);
return super.onLoad(); return super.onLoad();
} }
@ -80,7 +82,9 @@ void main() {
late GameBloc gameBloc; late GameBloc gameBloc;
setUp(() async { setUp(() async {
await Future.wait<void>(game.preLoadAssets().map((e) => e())); await Future.wait<void>(
game.preLoadAssets().map((loadableBuilder) => loadableBuilder()),
);
characterThemeCubit = _MockCharacterThemeCubit(); characterThemeCubit = _MockCharacterThemeCubit();
gameBloc = _MockGameBloc(); gameBloc = _MockGameBloc();
@ -181,7 +185,9 @@ void main() {
final startGameBloc = _MockStartGameBloc(); final startGameBloc = _MockStartGameBloc();
setUp(() async { setUp(() async {
await Future.wait<void>(game.preLoadAssets().map((e) => e())); await Future.wait<void>(
game.preLoadAssets().map((loadableBuilder) => loadableBuilder()),
);
whenListen( whenListen(
gameBloc, gameBloc,

Loading…
Cancel
Save