feat: tested bloc

pull/151/head
alestiago 4 years ago
parent b699e7a15d
commit 16f86eb4aa

@ -15,9 +15,7 @@ void main() {
'decreases number of balls',
build: GameBloc.new,
act: (bloc) {
for (var i = 0; i < bloc.state.balls; i++) {
bloc.add(const BallLost());
}
},
expect: () => [
const GameState(
@ -28,21 +26,37 @@ void main() {
activatedDashNests: {},
bonusHistory: [],
),
],
);
});
group('BonusLostBall', () {
blocTest<GameBloc, GameState>(
'decreases number of balls',
build: GameBloc.new,
act: (bloc) {
for (var i = 0; i < 3; i++) {
bloc.add(DashNestActivated('$i'));
}
bloc.add(const BonusBallLost());
},
skip: 2,
expect: () => [
const GameState(
score: 0,
balls: 1,
bonusBalls: 0,
balls: 3,
bonusBalls: 1,
activatedBonusLetters: [],
activatedDashNests: {},
bonusHistory: [],
bonusHistory: [GameBonus.dashNest],
),
const GameState(
score: 0,
balls: 0,
balls: 3,
bonusBalls: 0,
activatedBonusLetters: [],
activatedDashNests: {},
bonusHistory: [],
bonusHistory: [GameBonus.dashNest],
),
],
);

@ -18,6 +18,19 @@ void main() {
});
});
group('BonusBallLost', () {
test('can be instantiated', () {
expect(const BonusBallLost(), isNotNull);
});
test('supports value equality', () {
expect(
BonusBallLost(),
equals(const BonusBallLost()),
);
});
});
group('Scored', () {
test('can be instantiated', () {
expect(const Scored(points: 1), isNotNull);

Loading…
Cancel
Save