test: 테스트 코드 업데이트
- 변경된 API에 맞게 테스트 수정
This commit is contained in:
@@ -23,13 +23,17 @@ Widget _buildTestApp(Widget child) {
|
||||
|
||||
class _FakeSaveManager implements SaveManager {
|
||||
@override
|
||||
Future<SaveOutcome> saveState(GameState state, {String? fileName}) async {
|
||||
Future<SaveOutcome> saveState(
|
||||
GameState state, {
|
||||
String? fileName,
|
||||
bool cheatsEnabled = false,
|
||||
}) async {
|
||||
return const SaveOutcome.success();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<(SaveOutcome, GameState?)> loadState({String? fileName}) async {
|
||||
return (const SaveOutcome.success(), null);
|
||||
Future<(SaveOutcome, GameState?, bool)> loadState({String? fileName}) async {
|
||||
return (const SaveOutcome.success(), null, false);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user