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.
33 lines
817 B
33 lines
817 B
3 years ago
|
// ignore_for_file: prefer_const_constructors
|
||
|
|
||
|
import 'package:bloc_test/bloc_test.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter_test/flutter_test.dart';
|
||
|
import 'package:pinball/game/game.dart';
|
||
|
import '../../helpers/helpers.dart';
|
||
|
|
||
|
void main() {
|
||
|
group('GameHud', () {
|
||
|
testWidgets(
|
||
|
'renders the current score and balls',
|
||
|
(tester) async {
|
||
|
final state = GameState(score: 10, balls: 2);
|
||
|
final gameBloc = MockGameBloc();
|
||
|
whenListen(
|
||
|
gameBloc,
|
||
|
Stream.value(state),
|
||
|
initialState: state,
|
||
|
);
|
||
|
|
||
|
await tester.pumpApp(
|
||
|
GameHud(),
|
||
|
gameBloc: gameBloc,
|
||
|
);
|
||
|
|
||
|
expect(find.text('10'), findsOneWidget);
|
||
|
expect(find.byType(CircleAvatar), findsNWidgets(2));
|
||
|
},
|
||
|
);
|
||
|
});
|
||
|
}
|