made icon optional and default to empty string & adjust all game instances
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 36s
Pull Request Pipeline / lint (pull_request) Successful in 46s

This commit is contained in:
2026-03-09 16:24:04 +01:00
parent 16dc9746bc
commit 43e9196dca
11 changed files with 367 additions and 254 deletions

View File

@@ -44,7 +44,6 @@ void main() {
ruleset: Ruleset.highestScore,
description: 'A board game about real estate',
color: GameColor.orange,
icon: '',
);
});
});
@@ -54,7 +53,6 @@ void main() {
});
group('Game Tests', () {
// Verifies that getAllGames returns an empty list when the database has no games.
test('getAllGames returns empty list when no games exist', () async {
final allGames = await database.gameDao.getAllGames();
@@ -106,7 +104,7 @@ void main() {
// Verifies that getGameById throws a StateError when the game doesn't exist.
test('getGameById throws exception for non-existent game', () async {
expect(
() => database.gameDao.getGameById(gameId: 'non-existent-id'),
() => database.gameDao.getGameById(gameId: 'non-existent-id'),
throwsA(isA<StateError>()),
);
});
@@ -134,7 +132,12 @@ void main() {
// Verifies that a game with empty optional fields can be added and retrieved.
test('addGame handles game with null optional fields', () async {
final gameWithNulls = Game(name: 'Simple Game', ruleset: Ruleset.lowestScore, description: 'A simple game', color: GameColor.green, icon: '');
final gameWithNulls = Game(
name: 'Simple Game',
ruleset: Ruleset.lowestScore,
description: 'A simple game',
color: GameColor.green,
);
final result = await database.gameDao.addGame(game: gameWithNulls);
expect(result, true);
@@ -419,9 +422,7 @@ void main() {
// Verifies that getGameCount updates correctly after deleting a game.
test('getGameCount updates correctly after deletion', () async {
await database.gameDao.addGamesAsList(
games: [testGame1, testGame2],
);
await database.gameDao.addGamesAsList(games: [testGame1, testGame2]);
final countBefore = await database.gameDao.getGameCount();
expect(countBefore, 2);
@@ -461,7 +462,6 @@ void main() {
ruleset: Ruleset.multipleWinners,
description: 'Description with émojis 🎮🎲',
color: GameColor.purple,
icon: '',
);
await database.gameDao.addGame(game: specialGame);
@@ -478,7 +478,6 @@ void main() {
name: '',
ruleset: Ruleset.singleWinner,
description: '',
icon: '',
color: GameColor.red,
);
await database.gameDao.addGame(game: emptyGame);
@@ -500,7 +499,6 @@ void main() {
description: longString,
ruleset: Ruleset.multipleWinners,
color: GameColor.yellow,
icon: '',
);
await database.gameDao.addGame(game: longGame);