From 278544788e57eacc1ad65cd7089ca124f3afbf99 Mon Sep 17 00:00:00 2001 From: gelbeinhalb Date: Sat, 7 Feb 2026 17:40:27 +0100 Subject: [PATCH] fix formatting --- test/db_tests/aggregates/match_test.dart | 40 ++++++++----------- .../relationships/player_match_test.dart | 18 ++++----- 2 files changed, 23 insertions(+), 35 deletions(-) diff --git a/test/db_tests/aggregates/match_test.dart b/test/db_tests/aggregates/match_test.dart index 4935f81..0718e0d 100644 --- a/test/db_tests/aggregates/match_test.dart +++ b/test/db_tests/aggregates/match_test.dart @@ -122,19 +122,15 @@ void main() { } else { fail('Group is null'); } - if (result.players != null) { - expect(result.players!.length, testMatch1.players!.length); + expect(result.players.length, testMatch1.players.length); - for (int i = 0; i < testMatch1.players!.length; i++) { - expect(result.players![i].id, testMatch1.players![i].id); - expect(result.players![i].name, testMatch1.players![i].name); - expect( - result.players![i].createdAt, - testMatch1.players![i].createdAt, - ); - } - } else { - fail('Players is null'); + for (int i = 0; i < testMatch1.players.length; i++) { + expect(result.players[i].id, testMatch1.players[i].id); + expect(result.players[i].name, testMatch1.players[i].name); + expect( + result.players[i].createdAt, + testMatch1.players[i].createdAt, + ); } }); @@ -191,18 +187,14 @@ void main() { } // Players-Checks - if (testMatch.players != null) { - expect(match.players!.length, testMatch.players!.length); - for (int i = 0; i < testMatch.players!.length; i++) { - expect(match.players![i].id, testMatch.players![i].id); - expect(match.players![i].name, testMatch.players![i].name); - expect( - match.players![i].createdAt, - testMatch.players![i].createdAt, - ); - } - } else { - expect(match.players, null); + expect(match.players.length, testMatch.players.length); + for (int i = 0; i < testMatch.players.length; i++) { + expect(match.players[i].id, testMatch.players[i].id); + expect(match.players[i].name, testMatch.players[i].name); + expect( + match.players[i].createdAt, + testMatch.players[i].createdAt, + ); } } }); diff --git a/test/db_tests/relationships/player_match_test.dart b/test/db_tests/relationships/player_match_test.dart index 397f1b7..890e74e 100644 --- a/test/db_tests/relationships/player_match_test.dart +++ b/test/db_tests/relationships/player_match_test.dart @@ -140,7 +140,7 @@ void main() { test('Removing player from match works correctly', () async { await database.matchDao.addMatch(match: testMatchOnlyPlayers); - final playerToRemove = testMatchOnlyPlayers.players![0]; + final playerToRemove = testMatchOnlyPlayers.players[0]; final removed = await database.playerMatchDao.removePlayerFromMatch( playerId: playerToRemove.id, @@ -151,9 +151,9 @@ void main() { final result = await database.matchDao.getMatchById( matchId: testMatchOnlyPlayers.id, ); - expect(result.players!.length, testMatchOnlyPlayers.players!.length - 1); + expect(result.players.length, testMatchOnlyPlayers.players.length - 1); - final playerExists = result.players!.any( + final playerExists = result.players.any( (p) => p.id == playerToRemove.id, ); expect(playerExists, false); @@ -164,18 +164,14 @@ void main() { await database.matchDao.addMatch(match: testMatchOnlyPlayers); final players = await database.playerMatchDao.getPlayersOfMatch( matchId: testMatchOnlyPlayers.id, - ); - - if (players == null) { - fail('Players should not be null'); - } + ) ?? []; for (int i = 0; i < players.length; i++) { - expect(players[i].id, testMatchOnlyPlayers.players![i].id); - expect(players[i].name, testMatchOnlyPlayers.players![i].name); + expect(players[i].id, testMatchOnlyPlayers.players[i].id); + expect(players[i].name, testMatchOnlyPlayers.players[i].name); expect( players[i].createdAt, - testMatchOnlyPlayers.players![i].createdAt, + testMatchOnlyPlayers.players[i].createdAt, ); } });