test: 테스트 코드 업데이트
- 변경된 API에 맞게 테스트 수정
This commit is contained in:
@@ -13,14 +13,18 @@ class _FakeSaveManager implements SaveManager {
|
|||||||
final List<GameState> savedStates = [];
|
final List<GameState> savedStates = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<SaveOutcome> saveState(GameState state, {String? fileName}) async {
|
Future<SaveOutcome> saveState(
|
||||||
|
GameState state, {
|
||||||
|
String? fileName,
|
||||||
|
bool cheatsEnabled = false,
|
||||||
|
}) async {
|
||||||
savedStates.add(state);
|
savedStates.add(state);
|
||||||
return const SaveOutcome.success();
|
return const SaveOutcome.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<(SaveOutcome, GameState?)> loadState({String? fileName}) async {
|
Future<(SaveOutcome, GameState?, bool)> loadState({String? fileName}) async {
|
||||||
return (const SaveOutcome.success(), null);
|
return (const SaveOutcome.success(), null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -23,13 +23,17 @@ Widget _buildTestApp(Widget child) {
|
|||||||
|
|
||||||
class _FakeSaveManager implements SaveManager {
|
class _FakeSaveManager implements SaveManager {
|
||||||
@override
|
@override
|
||||||
Future<SaveOutcome> saveState(GameState state, {String? fileName}) async {
|
Future<SaveOutcome> saveState(
|
||||||
|
GameState state, {
|
||||||
|
String? fileName,
|
||||||
|
bool cheatsEnabled = false,
|
||||||
|
}) async {
|
||||||
return const SaveOutcome.success();
|
return const SaveOutcome.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<(SaveOutcome, GameState?)> loadState({String? fileName}) async {
|
Future<(SaveOutcome, GameState?, bool)> loadState({String? fileName}) async {
|
||||||
return (const SaveOutcome.success(), null);
|
return (const SaveOutcome.success(), null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -12,21 +12,25 @@ import 'package:flutter_test/flutter_test.dart';
|
|||||||
|
|
||||||
class FakeSaveManager implements SaveManager {
|
class FakeSaveManager implements SaveManager {
|
||||||
final List<GameState> savedStates = [];
|
final List<GameState> savedStates = [];
|
||||||
(SaveOutcome, GameState?) Function(String?)? onLoad;
|
(SaveOutcome, GameState?, bool) Function(String?)? onLoad;
|
||||||
SaveOutcome saveOutcome = const SaveOutcome.success();
|
SaveOutcome saveOutcome = const SaveOutcome.success();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<SaveOutcome> saveState(GameState state, {String? fileName}) async {
|
Future<SaveOutcome> saveState(
|
||||||
|
GameState state, {
|
||||||
|
String? fileName,
|
||||||
|
bool cheatsEnabled = false,
|
||||||
|
}) async {
|
||||||
savedStates.add(state);
|
savedStates.add(state);
|
||||||
return saveOutcome;
|
return saveOutcome;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<(SaveOutcome, GameState?)> loadState({String? fileName}) async {
|
Future<(SaveOutcome, GameState?, bool)> loadState({String? fileName}) async {
|
||||||
if (onLoad != null) {
|
if (onLoad != null) {
|
||||||
return onLoad!(fileName);
|
return onLoad!(fileName);
|
||||||
}
|
}
|
||||||
return (const SaveOutcome.success(), null);
|
return (const SaveOutcome.success(), null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -122,7 +126,7 @@ void main() {
|
|||||||
test('loadAndStart surfaces save load errors', () {
|
test('loadAndStart surfaces save load errors', () {
|
||||||
fakeAsync((async) {
|
fakeAsync((async) {
|
||||||
final saveManager = FakeSaveManager()
|
final saveManager = FakeSaveManager()
|
||||||
..onLoad = (_) => (const SaveOutcome.failure('boom'), null);
|
..onLoad = (_) => (const SaveOutcome.failure('boom'), null, false);
|
||||||
final controller = buildController(async, saveManager);
|
final controller = buildController(async, saveManager);
|
||||||
|
|
||||||
controller.loadAndStart(fileName: 'bad.pqf');
|
controller.loadAndStart(fileName: 'bad.pqf');
|
||||||
|
|||||||
Reference in New Issue
Block a user