fix: mock flame images

pull/247/head
arturplaczek 3 years ago
parent de94d66e15
commit 3120d0ca90

@ -14,7 +14,6 @@ void main() {
setUp(() async {
await mockFlameImages();
startGameBloc = _MockStartGameBloc();
whenListen(

@ -2,7 +2,6 @@ import 'package:bloc_test/bloc_test.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail/mocktail.dart';
import 'package:pinball/how_to_play/how_to_play.dart';
import 'package:pinball/select_character/select_character.dart';
import 'package:pinball/start_game/start_game.dart';
import 'package:pinball_theme/pinball_theme.dart';
@ -50,7 +49,13 @@ void main() {
testWidgets(
'tapping the select button dismisses the character '
'dialog and shows the how to play dialog', (tester) async {
'dialog and calls CharacterSelected event to the bloc', (tester) async {
whenListen(
startGameBloc,
const Stream<StartGameState>.empty(),
initialState: const StartGameState.initial(),
);
await tester.pumpApp(
const CharacterSelectionDialog(),
characterThemeCubit: characterThemeCubit,
@ -59,7 +64,7 @@ void main() {
await tester.tap(find.byType(PinballButton));
await tester.pumpAndSettle();
expect(find.byType(CharacterSelectionDialog), findsNothing);
expect(find.byType(HowToPlayDialog), findsOneWidget);
verify(() => startGameBloc.add(const CharacterSelected())).called(1);
});
testWidgets('updating the selected character updates the preview',

@ -1,5 +1,4 @@
import 'package:bloc_test/bloc_test.dart';
import 'package:flame/flame.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail/mocktail.dart';
@ -8,7 +7,6 @@ import 'package:pinball/how_to_play/how_to_play.dart';
import 'package:pinball/select_character/select_character.dart';
import 'package:pinball/start_game/start_game.dart';
import 'package:pinball_audio/pinball_audio.dart';
import 'package:pinball_theme/pinball_theme.dart';
import '../../helpers/helpers.dart';
@ -30,11 +28,7 @@ void main() {
group('StartGameListener', () {
setUp(() async {
Flame.images.prefix = '';
await Flame.images.load(const DashTheme().animation.keyName);
await Flame.images.load(const AndroidTheme().animation.keyName);
await Flame.images.load(const DinoTheme().animation.keyName);
await Flame.images.load(const SparkyTheme().animation.keyName);
await mockFlameImages();
startGameBloc = _MockStartGameBloc();
pinballGame = _MockPinballGame();

Loading…
Cancel
Save