28 lines
826 B
Dart
28 lines
826 B
Dart
import 'package:block_seasons/game/models/booster.dart';
|
|
import 'package:block_seasons/ui/widgets/booster_bar.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
testWidgets('renders three boosters with their counts', (tester) async {
|
|
BoosterType? tapped;
|
|
await tester.pumpWidget(MaterialApp(
|
|
home: Scaffold(
|
|
body: BoosterBar(
|
|
counts: const {
|
|
BoosterType.hammer: 3,
|
|
BoosterType.shuffle: 0,
|
|
BoosterType.lineBomb: 1,
|
|
},
|
|
onTap: (t) => tapped = t,
|
|
),
|
|
),
|
|
));
|
|
|
|
expect(find.text('3'), findsOneWidget);
|
|
expect(find.text('1'), findsOneWidget);
|
|
await tester.tap(find.byKey(const ValueKey('booster_hammer')));
|
|
expect(tapped, BoosterType.hammer);
|
|
});
|
|
}
|