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.
pinball/test/game/components/multipliers/multipliers_test.dart

64 lines
1.7 KiB

feat: implemented `Multipliers` (#231) * feat: added multipliers * feat: added multipliers to sandbox * test: tests and golden tests for multipliers * feat: multipliers controller * fix: missed assets load * refactor: multiplier refactored and tested * refactor: changed sandbox for multipliers * feat: multiplier controller * refactor: moved assets to constructor at sandbox * test: coverage for multipliers * test: removed test * refactor: coverage for multiplier * test: coverage for multiplier * chore: multiplier doc * Update packages/pinball_components/sandbox/lib/stories/multipliers/multipliers_game.dart Co-authored-by: Alejandro Santiago <dev@alestiago.com> * chore: little code refactor, doc * refactor: multiplier creation refactored * test: fixed tests for multipliers * refactor: changed properties names * refactor: multipliers cubit * test: refactored tests for multipliers * refactored: sandbow for multipliers * refactor: multipliers controller * test: tests for multiplier behavior * chore: analysis errors * feat: multipliers behavior with multiplier from gamebloc * refactor: changed toggle to next at multipliers * test: coverage for cubit * refactor: refactored multipliers and coverage * refactor: sandbox * test: flamebloctester * Update lib/game/components/multipliers/multipliers.dart Co-authored-by: Allison Ryan <77211884+allisonryan0002@users.noreply.github.com> * Update packages/pinball_components/lib/src/components/multiplier/cubit/multiplier_cubit.dart Co-authored-by: Allison Ryan <77211884+allisonryan0002@users.noreply.github.com> * Update lib/game/components/multipliers/multipliers.dart Co-authored-by: Allison Ryan <77211884+allisonryan0002@users.noreply.github.com> * Update packages/pinball_components/lib/src/components/multiplier/cubit/multiplier_state.dart Co-authored-by: Allison Ryan <77211884+allisonryan0002@users.noreply.github.com> * Update packages/pinball_components/lib/src/components/multiplier/cubit/multiplier_state.dart Co-authored-by: Allison Ryan <77211884+allisonryan0002@users.noreply.github.com> * Update test/game/components/multipliers/behaviors/multipliers_behavior_test.dart Co-authored-by: Allison Ryan <77211884+allisonryan0002@users.noreply.github.com> * test: fixed test names and golden files * test: golden tests * fix: fixed bloc bug for tests on multiplier behavior * chore: renamed rotation * chore: doc ignore * test: grouped * test: golden tests dir * Update packages/pinball_components/sandbox/lib/stories/multipliers/stories.dart Co-authored-by: Allison Ryan <77211884+allisonryan0002@users.noreply.github.com> * refactor: moved extension for multiplier value * chore: multiplier extension equalsTo name * fixed: missed method rename Co-authored-by: Alejandro Santiago <dev@alestiago.com> Co-authored-by: Allison Ryan <77211884+allisonryan0002@users.noreply.github.com>
3 years ago
// ignore_for_file: cascade_invocations
import 'package:flame_test/flame_test.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pinball/game/game.dart';
import 'package:pinball_components/pinball_components.dart';
import '../../../helpers/helpers.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
final assets = [
Assets.images.multiplier.x2.lit.keyName,
Assets.images.multiplier.x2.dimmed.keyName,
Assets.images.multiplier.x3.lit.keyName,
Assets.images.multiplier.x3.dimmed.keyName,
Assets.images.multiplier.x4.lit.keyName,
Assets.images.multiplier.x4.dimmed.keyName,
Assets.images.multiplier.x5.lit.keyName,
Assets.images.multiplier.x5.dimmed.keyName,
Assets.images.multiplier.x6.lit.keyName,
Assets.images.multiplier.x6.dimmed.keyName,
];
late GameBloc gameBloc;
setUp(() {
gameBloc = GameBloc();
});
final flameBlocTester = FlameBlocTester<PinballGame, GameBloc>(
gameBuilder: EmptyPinballTestGame.new,
blocBuilder: () => gameBloc,
assets: assets,
);
group('Multipliers', () {
flameBlocTester.testGameWidget(
'loads correctly',
setUp: (game, tester) async {
final multipliersGroup = Multipliers();
await game.ensureAdd(multipliersGroup);
expect(game.contains(multipliersGroup), isTrue);
},
);
group('loads', () {
flameBlocTester.testGameWidget(
'five Multiplier',
setUp: (game, tester) async {
final multipliersGroup = Multipliers();
await game.ensureAdd(multipliersGroup);
expect(
multipliersGroup.descendants().whereType<Multiplier>().length,
equals(5),
);
},
);
});
});
}