summaryrefslogtreecommitdiff
path: root/server/test
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2026-11-23 15:38:13 +0100
committerJoel Klinghed <the_jk@spawned.biz>2026-11-23 15:38:13 +0100
commit7ee14396b1f1f96ed0472b5949ce82a7f9313276 (patch)
treecddf00fe4049908155a15e813bb8d226ad710f81 /server/test
parent4a45fe143bd050d89183427443dedfd656f507bc (diff)
server: make local variables final (prefer_final_locals)
270 locals across 52 files. Six of them were declared with an unnecessarily nullable type (ModifierDeck? / LootDeckModel?) although the initializer is non-nullable; non-final locals were silently flow-promoted to the initializer's type, but final locals are not, so the nullability is dropped where it was wrong.
Diffstat (limited to 'server/test')
-rw-r--r--server/test/command/add_character_command_test.dart6
-rw-r--r--server/test/command/amd_remove_minus_1_command_test.dart6
-rw-r--r--server/test/command/test_helpers.dart8
-rw-r--r--server/test/resource/game_methods_test.dart148
4 files changed, 84 insertions, 84 deletions
diff --git a/server/test/command/add_character_command_test.dart b/server/test/command/add_character_command_test.dart
index 4fe9f1c..0795c3c 100644
--- a/server/test/command/add_character_command_test.dart
+++ b/server/test/command/add_character_command_test.dart
@@ -8,8 +8,8 @@ import 'package:x_haven_server/core/state/game_state.dart';
import 'test_helpers.dart';
void _tests() {
- String oldState = gameState.toString();
- AddCharacterCommand command = AddCharacterCommand(
+ final String oldState = gameState.toString();
+ final AddCharacterCommand command = AddCharacterCommand(
"Hatchet",
"Jaws of the Lion",
"Arnold",
@@ -29,7 +29,7 @@ void _tests() {
"Hatchet",
);
expect(gameState.currentList.length, 1);
- Character brute = GameMethods.getCurrentCharacters().first;
+ final Character brute = GameMethods.getCurrentCharacters().first;
expect(brute.characterState.display, "Arnold");
expect(brute.characterState.level, 9);
expect(gameState.unlockedClasses.first, "Hatchet");
diff --git a/server/test/command/amd_remove_minus_1_command_test.dart b/server/test/command/amd_remove_minus_1_command_test.dart
index 715dc1d..0d3c950 100644
--- a/server/test/command/amd_remove_minus_1_command_test.dart
+++ b/server/test/command/amd_remove_minus_1_command_test.dart
@@ -38,7 +38,7 @@ void main() {
test('should remove a minus one card from a character deck', () {
// Arrange
final modifierDeck = character.characterState.modifierDeck;
- int initialCount = _getMinusOnes(modifierDeck);
+ final int initialCount = _getMinusOnes(modifierDeck);
expect(initialCount, 5);
final command = AMDRemoveMinus1Command(
@@ -61,7 +61,7 @@ void main() {
character.id,
gameState: getIt<GameState>(),
).execute(); // Add one first
- int initialCount = _getMinusOnes(modifierDeck);
+ final int initialCount = _getMinusOnes(modifierDeck);
expect(initialCount, 6);
final command = AMDRemoveMinus1Command(
@@ -84,7 +84,7 @@ void main() {
character.id,
gameState: getIt<GameState>(),
).execute(); // Add one first
- int initialCount = _getMinusOnes(modifierDeck);
+ final int initialCount = _getMinusOnes(modifierDeck);
expect(initialCount, 6);
final command = AMDRemoveMinus1Command(
diff --git a/server/test/command/test_helpers.dart b/server/test/command/test_helpers.dart
index 67e6f16..3480d58 100644
--- a/server/test/command/test_helpers.dart
+++ b/server/test/command/test_helpers.dart
@@ -25,11 +25,11 @@ Future<void> setUpGame() async {
}
void checkSaveState() {
- String state = gameState.toString();
- int nrStates = gameState.gameSaveStates.length;
+ final String state = gameState.toString();
+ final int nrStates = gameState.gameSaveStates.length;
gameState.save();
gameState.load();
- String newState = gameState.toString();
+ final String newState = gameState.toString();
assert(
gameState.gameSaveStates.length == nrStates + 2,
); //for some reason a null state is added on load.
@@ -41,7 +41,7 @@ void checkNoSideEffects(List<String> changedFields, String oldState) {
json.decode(oldState),
json.decode(gameState.toString()),
);
- DiffNode diff = differ.diff();
+ final DiffNode diff = differ.diff();
diff.forEach((s, dn) {
print("for each");
diff --git a/server/test/resource/game_methods_test.dart b/server/test/resource/game_methods_test.dart
index f960ca9..dfa60fe 100644
--- a/server/test/resource/game_methods_test.dart
+++ b/server/test/resource/game_methods_test.dart
@@ -32,7 +32,7 @@ void main() async {
test('should return 2 + game level when level is 4', () {
// Act: Call the method we are testing.
SetLevelCommand(4, null).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final result = GameMethods.getTrapValue();
// Assert: Check if the result is what we expect.
@@ -42,7 +42,7 @@ void main() async {
test('should return 2 when game level is 0', () {
SetLevelCommand(0, null).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
// Act
final result = GameMethods.getTrapValue();
@@ -53,7 +53,7 @@ void main() async {
test('should return 9 when game level is 7', () {
SetLevelCommand(7, null).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
// Act
final result = GameMethods.getTrapValue();
@@ -291,7 +291,7 @@ void main() async {
35,
gameState: getIt<GameState>(),
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final character = getIt<GameState>().currentList.first as Character;
expect(GameMethods.getInitiative(character), 35);
checkNoSideEffects([], oldState);
@@ -316,7 +316,7 @@ void main() async {
test('should return the correct character', () {
getIt<GameState>().clearList();
AddCharacterCommand('Blinkblade', 'Frosthaven', "", 1).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final character = GameMethods.getCharacterByName('Blinkblade');
expect(character, isNotNull);
expect(character!.id, 'Blinkblade');
@@ -326,7 +326,7 @@ void main() async {
test('should return null if character does not exist', () {
getIt<GameState>().clearList();
AddCharacterCommand('Blinkblade', 'Frosthaven', "", 1).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final character = GameMethods.getCharacterByName(
'NonExistentCharacter',
);
@@ -340,7 +340,7 @@ void main() async {
getIt<GameState>().clearList();
AddCharacterCommand('Blinkblade', 'Frosthaven', "", 1).execute();
AddCharacterCommand('Banner Spear', 'Frosthaven', "", 1).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final characters = GameMethods.getCurrentCharacters();
expect(characters.length, 2);
expect(characters[1].id, 'Blinkblade');
@@ -350,7 +350,7 @@ void main() async {
test('should return an empty list if no characters', () {
getIt<GameState>().clearList();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final characters = GameMethods.getCurrentCharacters();
expect(characters, isEmpty);
checkNoSideEffects([], oldState);
@@ -372,7 +372,7 @@ void main() async {
'Blinkblade',
gameState: getIt<GameState>(),
).execute(); // It's now Banner Spear's turn
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final character = GameMethods.getCurrentCharacter();
expect(character, isNotNull);
expect(character!.id, 'Banner Spear');
@@ -391,7 +391,7 @@ void main() async {
getIt<GameState>().currentList.first.id,
gameState: getIt<GameState>(),
).execute(); // It's now a monster's turn
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final character = GameMethods.getCurrentCharacter();
expect(character, isNull);
checkNoSideEffects([], oldState);
@@ -400,14 +400,14 @@ void main() async {
group('getModifierDeck', () {
test('should return the monster modifier deck', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final deck = GameMethods.getModifierDeck('', getIt<GameState>());
expect(deck, equals(getIt<GameState>().modifierDeck));
checkNoSideEffects([], oldState);
});
test('should return the allies modifier deck', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final deck = GameMethods.getModifierDeck('allies', getIt<GameState>());
expect(deck, equals(getIt<GameState>().modifierDeckAllies));
checkNoSideEffects([], oldState);
@@ -421,7 +421,7 @@ void main() async {
'Blinkblade',
1,
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final deck = GameMethods.getModifierDeck(
'Blinkblade',
getIt<GameState>(),
@@ -441,7 +441,7 @@ void main() async {
'Blinkblade',
1,
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final character = getIt<GameState>().currentList.first as Character;
expect(GameMethods.canAddPerk(character, 0), isTrue);
checkNoSideEffects([], oldState);
@@ -457,7 +457,7 @@ void main() async {
).execute();
final character = getIt<GameState>().currentList.first as Character;
AddPerkCommand(character.id, 0).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.canAddPerk(character, 0), isFalse);
checkNoSideEffects([], oldState);
});
@@ -474,7 +474,7 @@ void main() async {
).execute();
final character = getIt<GameState>().currentList.first as Character;
AddPerkCommand(character.id, 0).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.canRemovePerk(character, 0), isTrue);
checkNoSideEffects([], oldState);
});
@@ -490,7 +490,7 @@ void main() async {
final character = getIt<GameState>().currentList.first as Character;
AddPerkCommand(character.id, 12).execute();
AddPerkCommand(character.id, 13).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.canRemovePerk(character, 5), isFalse);
checkNoSideEffects([], oldState);
});
@@ -498,7 +498,7 @@ void main() async {
group('perkGfxIdToCardId', () {
test('should return the original gfx id if it is not a perk', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final id = GameMethods.perkGfxIdToCardId(
'test',
PerkModel("", const [], const []),
@@ -509,7 +509,7 @@ void main() async {
});
test('should return the correct card id for a perk', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final perk = PerkModel("", const [], const ['perks/test']);
final id = GameMethods.perkGfxIdToCardId('perks/test', perk, 0);
expect(id, 'P0');
@@ -517,7 +517,7 @@ void main() async {
});
test('should return the correct card id for a perk with two images', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final perk = PerkModel("", const [], const [
'perks/test',
'perks/test2',
@@ -533,14 +533,14 @@ void main() async {
getIt<GameState>().clearList();
AddCharacterCommand('Blinkblade', 'Frosthaven', "", 1).execute();
AddCharacterCommand('Banner Spear', 'Frosthaven', "", 1).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.getCurrentCharacterAmount(), 2);
checkNoSideEffects([], oldState);
});
test('should return 0 if no characters', () {
getIt<GameState>().clearList();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.getCurrentCharacterAmount(), 0);
checkNoSideEffects([], oldState);
});
@@ -555,7 +555,7 @@ void main() async {
false,
gameState: getIt<GameState>(),
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final monsters = GameMethods.getCurrentMonsters();
expect(monsters.length, 3);
expect(monsters[0].id, 'Zealot');
@@ -566,7 +566,7 @@ void main() async {
test('should return an empty list if no monsters', () {
getIt<GameState>().clearList();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final monsters = GameMethods.getCurrentMonsters();
expect(monsters, isEmpty);
checkNoSideEffects([], oldState);
@@ -596,7 +596,7 @@ void main() async {
false,
gameState: getIt<GameState>(),
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final monster = getIt<GameState>().currentList.first as Monster;
final standee = GameMethods.getRandomStandee(monster);
expect(standee, isNot(0));
@@ -609,7 +609,7 @@ void main() async {
test('should return a character', () {
getIt<GameState>().clearList();
AddCharacterCommand('Blinkblade', 'Frosthaven', "", 1).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final figure = GameMethods.getFigure(null, 'Blinkblade');
expect(figure, isNotNull);
expect(figure, isA<CharacterState>());
@@ -632,7 +632,7 @@ void main() async {
false,
gameState: getIt<GameState>(),
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final figure = GameMethods.getFigure(
monster.id,
monster.monsterInstances.first.getId(),
@@ -661,7 +661,7 @@ void main() async {
false,
gameState: getIt<GameState>(),
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final id = GameMethods.getFigureIdFromNr(monster.id, 1);
expect(id, isNotNull);
expect(id, isNotEmpty);
@@ -672,7 +672,7 @@ void main() async {
group('isObjectiveOrEscort', () {
test('should return true for Objective', () {
final cmd = AddCharacterCommand("Objective", "na", "whatever", 1);
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(
GameMethods.isObjectiveOrEscort(cmd.character!.characterClass),
isTrue,
@@ -682,7 +682,7 @@ void main() async {
test('should return true for Escort', () {
final cmd = AddCharacterCommand("Escort", "na", "whatever", 1);
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(
GameMethods.isObjectiveOrEscort(cmd.character!.characterClass),
isTrue,
@@ -697,7 +697,7 @@ void main() async {
"whatever",
1,
);
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(
GameMethods.isObjectiveOrEscort(cmd.character!.characterClass),
isFalse,
@@ -708,7 +708,7 @@ void main() async {
group('shouldShowAlliesDeck', () {
test('should return true if showAllyDeck setting is true', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
getIt<Settings>().showAmdDeck = true;
ShowAllyDeckCommand().execute();
expect(GameMethods.shouldShowAlliesDeck(), isTrue);
@@ -716,7 +716,7 @@ void main() async {
});
test('should return false if showAmdDeck setting is false', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
getIt<Settings>().showAmdDeck = false;
expect(GameMethods.shouldShowAlliesDeck(), isFalse);
checkNoSideEffects([], oldState);
@@ -737,7 +737,7 @@ void main() async {
true,
gameState: getIt<GameState>(),
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.shouldShowAlliesDeck(), isTrue);
checkNoSideEffects([], oldState);
});
@@ -745,7 +745,7 @@ void main() async {
group('canExpire', () {
test('should return true for conditions that expire', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.canExpire(Condition.strengthen), isTrue);
expect(GameMethods.canExpire(Condition.muddle), isTrue);
expect(GameMethods.canExpire(Condition.invisible), isTrue);
@@ -758,7 +758,7 @@ void main() async {
});
test('should return false for conditions that do not expire', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.canExpire(Condition.bane), isFalse);
expect(GameMethods.canExpire(Condition.poison), isFalse);
expect(GameMethods.canExpire(Condition.wound), isFalse);
@@ -771,13 +771,13 @@ void main() async {
group('isFrosthavenStyledEdition', () {
test('should return true for Frosthaven', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.isFrosthavenStyledEdition('Frosthaven'), isTrue);
checkNoSideEffects([], oldState);
});
test('should return true for Buttons and Bugs', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(
GameMethods.isFrosthavenStyledEdition('Buttons and Bugs'),
isTrue,
@@ -786,7 +786,7 @@ void main() async {
});
test('should return true for Gloomhaven 2nd Edition', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(
GameMethods.isFrosthavenStyledEdition('Gloomhaven 2nd Edition'),
isTrue,
@@ -795,7 +795,7 @@ void main() async {
});
test('should return true for Mercenary Packs', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(
GameMethods.isFrosthavenStyledEdition('Mercenary Packs'),
isTrue,
@@ -804,7 +804,7 @@ void main() async {
});
test('should return false for Gloomhaven', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.isFrosthavenStyledEdition('Gloomhaven'), isFalse);
checkNoSideEffects([], oldState);
});
@@ -813,7 +813,7 @@ void main() async {
group('isFrosthavenStyle', () {
test('should return true for Frosthaven monster', () {
final monster = Monster('Ancient Artillery (FH)', 1, false);
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.isFrosthavenStyle(monster.type), isTrue);
checkNoSideEffects([], oldState);
});
@@ -825,7 +825,7 @@ void main() async {
false,
gameState: getIt<GameState>(),
).execute(); // Adds monsters
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final monster = Monster('Zealot', 1, false);
getIt<Settings>().style = Style.original;
expect(GameMethods.isFrosthavenStyle(monster.type), isFalse);
@@ -833,7 +833,7 @@ void main() async {
});
test('should return true if style is set to Frosthaven', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
getIt<Settings>().style = Style.frosthaven;
expect(GameMethods.isFrosthavenStyle(null), isTrue);
checkNoSideEffects([], oldState);
@@ -842,25 +842,25 @@ void main() async {
group('isCustomCampaign', () {
test('should return true for Crimson Scales', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.isCustomCampaign('Crimson Scales'), isTrue);
checkNoSideEffects([], oldState);
});
test('should return true for Trail of Ashes', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.isCustomCampaign('Trail of Ashes'), isTrue);
checkNoSideEffects([], oldState);
});
test('should return true for CCUG', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.isCustomCampaign('CCUG'), isTrue);
checkNoSideEffects([], oldState);
});
test('should return false for Frosthaven', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.isCustomCampaign('Frosthaven'), isFalse);
checkNoSideEffects([], oldState);
});
@@ -868,7 +868,7 @@ void main() async {
group('findNrFromScenarioName', () {
test('should return the scenario number from the name', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.findNrFromScenarioName('#1 '), 1);
expect(
GameMethods.findNrFromScenarioName('#10.0 A Sticky Situation'),
@@ -879,7 +879,7 @@ void main() async {
});
test('should return null if no number is found', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.findNrFromScenarioName('Some Scenario'), isNull);
checkNoSideEffects([], oldState);
});
@@ -888,14 +888,14 @@ void main() async {
group('isOgGloomEdition', () {
test('should return true for Gloomhaven', () {
SetCampaignCommand('Gloomhaven').execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.isOgGloomEdition(), isTrue);
checkNoSideEffects([], oldState);
});
test('should return false for Frosthaven', () {
SetCampaignCommand('Frosthaven').execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.isOgGloomEdition(), isFalse);
checkNoSideEffects([], oldState);
});
@@ -910,7 +910,7 @@ void main() async {
false,
gameState: getIt<GameState>(),
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
//DrawLootCardCommand(gameState: getIt<GameState>()).execute();
expect(GameMethods.hasLootDeck(), isTrue);
checkNoSideEffects([], oldState);
@@ -924,13 +924,13 @@ void main() async {
false,
gameState: getIt<GameState>(),
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.hasLootDeck(), isFalse);
checkNoSideEffects([], oldState);
});
test('should return false if hideLootDeck setting is true', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
getIt<Settings>().hideLootDeck = true;
expect(GameMethods.hasLootDeck(), isFalse);
checkNoSideEffects([], oldState);
@@ -939,7 +939,7 @@ void main() async {
group('getFactionCards', () {
test('should return the correct cards for Demons', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final cards = GameMethods.getFactionCards('Demons');
expect(cards.length, 4);
expect(cards[0].gfx, 'Demons-perks/plus1any');
@@ -947,7 +947,7 @@ void main() async {
});
test('should return the correct cards for Merchant-Guild', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final cards = GameMethods.getFactionCards('Merchant-Guild');
expect(cards.length, 4);
expect(cards[0].gfx, 'Merchant-Guild-perks/plus1curse');
@@ -955,7 +955,7 @@ void main() async {
});
test('should return the correct cards for Military', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final cards = GameMethods.getFactionCards('Military');
expect(cards.length, 4);
expect(cards[0].gfx, 'Military-perks/plus1strengthenally');
@@ -969,7 +969,7 @@ void main() async {
AddCharacterCommand('Blinkblade', 'Frosthaven', "", 1).execute();
final character = getIt<GameState>().currentList.first as Character;
AddPerkCommand(character.id, 3).execute(); // Adds a +1 card
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.isCardInAnyCharacterDeck('P3'), isTrue);
checkNoSideEffects([], oldState);
});
@@ -977,7 +977,7 @@ void main() async {
test('should return false if card is not in any character deck', () {
getIt<GameState>().clearList();
AddCharacterCommand('Blinkblade', 'Frosthaven', "", 1).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.isCardInAnyCharacterDeck('P3'), isFalse);
checkNoSideEffects([], oldState);
});
@@ -1000,7 +1000,7 @@ void main() async {
false,
gameState: getIt<GameState>(),
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final monster = getIt<GameState>().currentList.first as Monster;
final instance = monster.monsterInstances.first;
expect(GameMethods.hasRetaliate(monster, instance), isTrue);
@@ -1023,7 +1023,7 @@ void main() async {
false,
gameState: getIt<GameState>(),
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final monster = getIt<GameState>().currentList.first as Monster;
final instance = monster.monsterInstances.first;
expect(GameMethods.hasRetaliate(monster, instance), isFalse);
@@ -1048,7 +1048,7 @@ void main() async {
false,
gameState: getIt<GameState>(),
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final monster = getIt<GameState>().currentList.first as Monster;
final instance = monster.monsterInstances.first;
expect(GameMethods.hasShield(monster, instance), isTrue);
@@ -1071,7 +1071,7 @@ void main() async {
false,
gameState: getIt<GameState>(),
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final monster = getIt<GameState>().currentList.first as Monster;
final instance = monster.monsterInstances.first;
expect(GameMethods.hasShield(monster, instance), isFalse);
@@ -1114,7 +1114,7 @@ void main() async {
final monster = getIt<GameState>().currentList.first as Monster;
// Monster is inactive by default (isActive = false until ability drawn)
expect(monster.isActive, isFalse);
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.getInitiative(monster), 99);
checkNoSideEffects([], oldState);
});
@@ -1122,7 +1122,7 @@ void main() async {
group('summonDoesNotDie', () {
test('Glacial Torrent Glacier does not die', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(
GameMethods.summonDoesNotDie('Glacial Torrent', 'Glacier'),
isTrue,
@@ -1131,13 +1131,13 @@ void main() async {
});
test('D.O.M.E. Barrier does not die', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.summonDoesNotDie('D.O.M.E.', 'Barrier'), isTrue);
checkNoSideEffects([], oldState);
});
test('arbitrary owner and id returns false', () {
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(
GameMethods.summonDoesNotDie('Blinkblade', 'Jade Falcon'),
isFalse,
@@ -1174,7 +1174,7 @@ void main() async {
final summon = character.characterState.summonList.first;
final figureId = summon.getId();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final figure = GameMethods.getFigure('Blinkblade', figureId);
expect(figure, isNotNull);
expect(figure, isA<MonsterInstance>());
@@ -1186,7 +1186,7 @@ void main() async {
test('Solo with Frosthaven scenario number is frosthaven styled', () {
// Directly set the scenario string to avoid SetScenarioCommand's loot-deck lookup
gameState.scenario = '#1 A Town Aflame';
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.isFrosthavenStyledEdition('Solo'), isTrue);
checkNoSideEffects(['scenario'], oldState);
});
@@ -1195,7 +1195,7 @@ void main() async {
'Solo with #19 scenario is NOT frosthaven styled (Forgotten Circles)',
() {
gameState.scenario = '#19 Forgotten Circles';
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.isFrosthavenStyledEdition('Solo'), isFalse);
checkNoSideEffects(['scenario'], oldState);
},
@@ -1205,7 +1205,7 @@ void main() async {
'Solo with scenario not in 1-100 range is not frosthaven styled',
() {
gameState.scenario = '#200 Some Scenario';
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
expect(GameMethods.isFrosthavenStyledEdition('Solo'), isFalse);
checkNoSideEffects(['scenario'], oldState);
},
@@ -1256,7 +1256,7 @@ void main() async {
false,
gameState: getIt<GameState>(),
).execute();
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final next = GameMethods.getNextAvailableBnBStandee(monster);
// Standee 1 is taken; next available should be 2
expect(next, 2);
@@ -1282,7 +1282,7 @@ void main() async {
gameState: getIt<GameState>(),
).execute();
}
- String oldState = gameState.toString();
+ final String oldState = gameState.toString();
final next = GameMethods.getNextAvailableBnBStandee(monster);
expect(next, 0);
checkNoSideEffects([], oldState);