From b108375ad5a6bb0484898c8d9519bb00bb9e40ff Mon Sep 17 00:00:00 2001 From: gelbeinhalb Date: Tue, 20 Jan 2026 16:03:37 +0100 Subject: [PATCH] remove winner tests --- test/db_tests/match_test.dart | 80 ----------------------------------- 1 file changed, 80 deletions(-) diff --git a/test/db_tests/match_test.dart b/test/db_tests/match_test.dart index 1a7e407..8408586 100644 --- a/test/db_tests/match_test.dart +++ b/test/db_tests/match_test.dart @@ -278,86 +278,6 @@ void main() { expect(matchCount, 0); }); - // Verifies that hasWinner correctly identifies matches with and without winners. - test('Checking if match has winner works correctly', () async { - await database.matchDao.addMatch(match: testMatch1); - await database.matchDao.addMatch(match: testMatchOnlyGroup); - - var hasWinner = await database.matchDao.hasWinner(matchId: testMatch1.id); - expect(hasWinner, true); - - hasWinner = await database.matchDao.hasWinner( - matchId: testMatchOnlyGroup.id, - ); - expect(hasWinner, false); - }); - - // Verifies that getWinner returns the correct winner player for a match. - test('Fetching the winner of a match works correctly', () async { - await database.matchDao.addMatch(match: testMatch1); - - final winner = await database.matchDao.getWinner(matchId: testMatch1.id); - if (winner == null) { - fail('Winner is null'); - } else { - expect(winner.id, testMatch1.winner!.id); - expect(winner.name, testMatch1.winner!.name); - expect(winner.createdAt, testMatch1.winner!.createdAt); - } - }); - - // Verifies that setWinner correctly updates the winner of a match. - test('Updating the winner of a match works correctly', () async { - await database.matchDao.addMatch(match: testMatch1); - - final winner = await database.matchDao.getWinner(matchId: testMatch1.id); - if (winner == null) { - fail('Winner is null'); - } else { - expect(winner.id, testMatch1.winner!.id); - expect(winner.name, testMatch1.winner!.name); - expect(winner.createdAt, testMatch1.winner!.createdAt); - expect(winner.id, testPlayer4.id); - expect(winner.id != testPlayer5.id, true); - } - - await database.matchDao.setWinner( - matchId: testMatch1.id, - winnerId: testPlayer5.id, - ); - - final newWinner = await database.matchDao.getWinner( - matchId: testMatch1.id, - ); - - if (newWinner == null) { - fail('New winner is null'); - } else { - expect(newWinner.id, testPlayer5.id); - expect(newWinner.name, testPlayer5.name); - expect(newWinner.createdAt, testPlayer5.createdAt); - } - }); - - // Verifies that removeWinner clears the winner and hasWinner returns false. - test('Removing a winner works correctly', () async { - await database.matchDao.addMatch(match: testMatch2); - - var hasWinner = await database.matchDao.hasWinner(matchId: testMatch2.id); - expect(hasWinner, true); - - await database.matchDao.removeWinner(matchId: testMatch2.id); - - hasWinner = await database.matchDao.hasWinner(matchId: testMatch2.id); - expect(hasWinner, false); - - final removedWinner = await database.matchDao.getWinner( - matchId: testMatch2.id, - ); - - expect(removedWinner, null); - }); - // Verifies that updateMatchName correctly updates only the name field. test('Renaming a match works correctly', () async { await database.matchDao.addMatch(match: testMatch1);