feat: pr suggestions

pull/44/head
Erick Zanardo 4 years ago
parent 0ee9b9b950
commit fd4519a348

@ -28,13 +28,12 @@ void main() {
); );
group('listenWhen', () { group('listenWhen', () {
final previousState = MockGameState();
final currentState = MockGameState();
test( test(
'returns true when there is a new bonus word awarded', 'returns true when there is a new bonus word awarded',
() { () {
final previousState = MockGameState();
when(() => previousState.bonusHistory).thenReturn([]); when(() => previousState.bonusHistory).thenReturn([]);
final currentState = MockGameState();
when(() => currentState.bonusHistory).thenReturn([GameBonus.word]); when(() => currentState.bonusHistory).thenReturn([GameBonus.word]);
expect( expect(
@ -50,10 +49,7 @@ void main() {
test( test(
'returns false when there is no new bonus word awarded', 'returns false when there is no new bonus word awarded',
() { () {
final previousState = MockGameState();
when(() => previousState.bonusHistory).thenReturn([GameBonus.word]); when(() => previousState.bonusHistory).thenReturn([GameBonus.word]);
final currentState = MockGameState();
when(() => currentState.bonusHistory).thenReturn([GameBonus.word]); when(() => currentState.bonusHistory).thenReturn([GameBonus.word]);
expect( expect(
@ -68,10 +64,10 @@ void main() {
}); });
group('onNewState', () { group('onNewState', () {
final state = MockGameState();
flameTester.test( flameTester.test(
'adds sequence effect to the letters when the player receives a bonus', 'adds sequence effect to the letters when the player receives a bonus',
(game) async { (game) async {
final state = MockGameState();
when(() => state.bonusHistory).thenReturn([GameBonus.word]); when(() => state.bonusHistory).thenReturn([GameBonus.word]);
final bonusWord = BonusWord(position: Vector2.zero()); final bonusWord = BonusWord(position: Vector2.zero());
@ -96,7 +92,6 @@ void main() {
flameTester.test( flameTester.test(
'adds a color effect to reset the color when the sequence is finished', 'adds a color effect to reset the color when the sequence is finished',
(game) async { (game) async {
final state = MockGameState();
when(() => state.bonusHistory).thenReturn([GameBonus.word]); when(() => state.bonusHistory).thenReturn([GameBonus.word]);
final bonusWord = BonusWord(position: Vector2.zero()); final bonusWord = BonusWord(position: Vector2.zero());

Loading…
Cancel
Save