mirror of https://github.com/flutter/pinball.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.4 KiB
42 lines
1.4 KiB
import 'package:authentication_repository/authentication_repository.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:leaderboard_repository/leaderboard_repository.dart';
|
|
import 'package:mocktail/mocktail.dart';
|
|
import 'package:pinball/app/app.dart';
|
|
import 'package:pinball/game/game.dart';
|
|
import 'package:pinball_audio/pinball_audio.dart';
|
|
|
|
class _MockAuthenticationRepository extends Mock
|
|
implements AuthenticationRepository {}
|
|
|
|
class _MockPinballAudio extends Mock implements PinballAudio {}
|
|
|
|
class _MockLeaderboardRepository extends Mock implements LeaderboardRepository {
|
|
}
|
|
|
|
void main() {
|
|
group('App', () {
|
|
late AuthenticationRepository authenticationRepository;
|
|
late LeaderboardRepository leaderboardRepository;
|
|
late PinballAudio pinballAudio;
|
|
|
|
setUp(() {
|
|
authenticationRepository = _MockAuthenticationRepository();
|
|
leaderboardRepository = _MockLeaderboardRepository();
|
|
pinballAudio = _MockPinballAudio();
|
|
when(pinballAudio.load).thenAnswer((_) => Future.value());
|
|
});
|
|
|
|
testWidgets('renders PinballGamePage', (tester) async {
|
|
await tester.pumpWidget(
|
|
App(
|
|
authenticationRepository: authenticationRepository,
|
|
leaderboardRepository: leaderboardRepository,
|
|
pinballAudio: pinballAudio,
|
|
),
|
|
);
|
|
expect(find.byType(PinballGamePage), findsOneWidget);
|
|
});
|
|
});
|
|
}
|