test(domain): cover skip bonus and invalid-guess paths in GameEngine
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
e3a9831ce1
commit
e2e310cae5
@ -1,4 +1,5 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pokeguess/core/config/app_constants.dart';
|
||||
import 'package:pokeguess/domain/entities/pokemon.dart';
|
||||
import 'package:pokeguess/domain/game/game_engine.dart';
|
||||
import 'package:pokeguess/domain/game/game_state.dart';
|
||||
@ -102,6 +103,21 @@ void main() {
|
||||
final r = _engine.useSkip(s);
|
||||
expect(r.skips, 2);
|
||||
});
|
||||
|
||||
test('bonus: skip tous les 10 bonnes réponses', () {
|
||||
var s = const GameState(sessionCorrectCount: 9, status: GameStatus.playing);
|
||||
s = _engine.startRound(s, _poke('pikachu'), isShiny: false);
|
||||
final o = _engine.submitGuess(s, 'pikachu'); // 10e bonne réponse
|
||||
expect(o.state.sessionCorrectCount, 10);
|
||||
expect(o.state.skips, AppConstants.startingSkips + 1);
|
||||
});
|
||||
|
||||
test('submitGuess renvoie invalid quand la manche n\'est pas en cours', () {
|
||||
const s = GameState(status: GameStatus.loading); // aucun pokemon, pas en playing
|
||||
final o = _engine.submitGuess(s, 'pikachu');
|
||||
expect(o.result, GuessResult.invalid);
|
||||
expect(identical(o.state, s), true);
|
||||
});
|
||||
}
|
||||
|
||||
/// Valeur attendue de hints au démarrage (miroir d'AppConstants.startingHints = 3).
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user