description is now a required game parameter

This commit is contained in:
gelbeinhalb
2026-01-23 11:25:20 +01:00
parent 55f5aac4e2
commit 118b316a35
11 changed files with 41 additions and 42 deletions

View File

@@ -131,7 +131,7 @@ void main() {
// Verifies that a game with null optional fields can be added and retrieved.
test('addGame handles game with null optional fields', () async {
final gameWithNulls = Game(name: 'Simple Game', color: '0xFF000000');
final gameWithNulls = Game(name: 'Simple Game', description: 'A simple game', color: '0xFF000000');
final result = await database.gameDao.addGame(game: gameWithNulls);
expect(result, true);
@@ -139,7 +139,7 @@ void main() {
gameId: gameWithNulls.id,
);
expect(fetchedGame.name, 'Simple Game');
expect(fetchedGame.description, isNull);
expect(fetchedGame.description, 'A simple game');
expect(fetchedGame.color, '0xFF000000');
expect(fetchedGame.icon, isNull);
});
@@ -305,19 +305,19 @@ void main() {
expect(updatedGame.description, 'An updated description');
});
// Verifies that updateGameDescription can set the description to null.
test('updateGameDescription can set description to null', () async {
// Verifies that updateGameDescription can set the description to an empty string.
test('updateGameDescription can set description to empty string', () async {
await database.gameDao.addGame(game: testGame1);
await database.gameDao.updateGameDescription(
gameId: testGame1.id,
newDescription: null,
newDescription: '',
);
final updatedGame = await database.gameDao.getGameById(
gameId: testGame1.id,
);
expect(updatedGame.description, isNull);
expect(updatedGame.description, '');
});
// Verifies that updateGameDescription does nothing when game doesn't exist.
@@ -502,7 +502,7 @@ void main() {
gameId: longGame.id,
);
expect(fetchedGame.name.length, 10000);
expect(fetchedGame.description?.length, 10000);
expect(fetchedGame.description.length, 10000);
expect(fetchedGame.ruleset?.length, 10000);
});

View File

@@ -48,7 +48,7 @@ void main() {
name: 'Test Group 2',
members: [testPlayer4, testPlayer5],
);
testGame = Game(name: 'Test Game', color: '0xFF000000');
testGame = Game(name: 'Test Game', description: 'A test game', color: '0xFF000000');
testMatch1 = Match(
name: 'First Test Match',
game: testGame,

View File

@@ -46,7 +46,7 @@ void main() {
name: 'Test Group',
members: [testPlayer1, testPlayer2, testPlayer3],
);
testGame = Game(name: 'Test Game', color: '0xFF000000');
testGame = Game(name: 'Test Game', description: 'A test game', color: '0xFF000000');
testMatchOnlyGroup = Match(
name: 'Test Match with Group',
game: testGame,

View File

@@ -31,7 +31,7 @@ void main() {
testPlayer1 = Player(name: 'Alice');
testPlayer2 = Player(name: 'Bob');
testPlayer3 = Player(name: 'Charlie');
testGame = Game(name: 'Test Game', color: '0xFF000000');
testGame = Game(name: 'Test Game', description: 'A test game', color: '0xFF000000');
testMatch1 = Match(
name: 'Test Match 1',
game: testGame,

View File

@@ -48,8 +48,8 @@ void main() {
name: 'Team Gamma',
members: [testPlayer1, testPlayer3],
);
testGame1 = Game(name: 'Game 1', color: '0xFF000000');
testGame2 = Game(name: 'Game 2', color: '0xFF000000');
testGame1 = Game(name: 'Game 1', description: 'Test game 1', color: '0xFF000000');
testGame2 = Game(name: 'Game 2', description: 'Test game 2', color: '0xFF000000');
});
await database.playerDao.addPlayersAsList(