test: 테스트 코드 업데이트

- 변경된 API에 맞게 테스트 수정
This commit is contained in:
JiWoong Sul
2026-01-08 16:05:20 +09:00
parent cfc1537af2
commit 4af3830bb5
3 changed files with 23 additions and 11 deletions

View File

@@ -12,21 +12,25 @@ import 'package:flutter_test/flutter_test.dart';
class FakeSaveManager implements SaveManager {
final List<GameState> savedStates = [];
(SaveOutcome, GameState?) Function(String?)? onLoad;
(SaveOutcome, GameState?, bool) Function(String?)? onLoad;
SaveOutcome saveOutcome = const SaveOutcome.success();
@override
Future<SaveOutcome> saveState(GameState state, {String? fileName}) async {
Future<SaveOutcome> saveState(
GameState state, {
String? fileName,
bool cheatsEnabled = false,
}) async {
savedStates.add(state);
return saveOutcome;
}
@override
Future<(SaveOutcome, GameState?)> loadState({String? fileName}) async {
Future<(SaveOutcome, GameState?, bool)> loadState({String? fileName}) async {
if (onLoad != null) {
return onLoad!(fileName);
}
return (const SaveOutcome.success(), null);
return (const SaveOutcome.success(), null, false);
}
@override
@@ -122,7 +126,7 @@ void main() {
test('loadAndStart surfaces save load errors', () {
fakeAsync((async) {
final saveManager = FakeSaveManager()
..onLoad = (_) => (const SaveOutcome.failure('boom'), null);
..onLoad = (_) => (const SaveOutcome.failure('boom'), null, false);
final controller = buildController(async, saveManager);
controller.loadAndStart(fileName: 'bad.pqf');