fix formatting
This commit is contained in:
@@ -122,20 +122,16 @@ void main() {
|
|||||||
} else {
|
} else {
|
||||||
fail('Group is null');
|
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++) {
|
for (int i = 0; i < testMatch1.players.length; i++) {
|
||||||
expect(result.players![i].id, testMatch1.players![i].id);
|
expect(result.players[i].id, testMatch1.players[i].id);
|
||||||
expect(result.players![i].name, testMatch1.players![i].name);
|
expect(result.players[i].name, testMatch1.players[i].name);
|
||||||
expect(
|
expect(
|
||||||
result.players![i].createdAt,
|
result.players[i].createdAt,
|
||||||
testMatch1.players![i].createdAt,
|
testMatch1.players[i].createdAt,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
fail('Players is null');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Verifies that multiple matches can be added and retrieved with correct groups and players.
|
// Verifies that multiple matches can be added and retrieved with correct groups and players.
|
||||||
@@ -191,19 +187,15 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Players-Checks
|
// Players-Checks
|
||||||
if (testMatch.players != null) {
|
expect(match.players.length, testMatch.players.length);
|
||||||
expect(match.players!.length, testMatch.players!.length);
|
for (int i = 0; i < testMatch.players.length; i++) {
|
||||||
for (int i = 0; i < testMatch.players!.length; i++) {
|
expect(match.players[i].id, testMatch.players[i].id);
|
||||||
expect(match.players![i].id, testMatch.players![i].id);
|
expect(match.players[i].name, testMatch.players[i].name);
|
||||||
expect(match.players![i].name, testMatch.players![i].name);
|
|
||||||
expect(
|
expect(
|
||||||
match.players![i].createdAt,
|
match.players[i].createdAt,
|
||||||
testMatch.players![i].createdAt,
|
testMatch.players[i].createdAt,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
expect(match.players, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ void main() {
|
|||||||
test('Removing player from match works correctly', () async {
|
test('Removing player from match works correctly', () async {
|
||||||
await database.matchDao.addMatch(match: testMatchOnlyPlayers);
|
await database.matchDao.addMatch(match: testMatchOnlyPlayers);
|
||||||
|
|
||||||
final playerToRemove = testMatchOnlyPlayers.players![0];
|
final playerToRemove = testMatchOnlyPlayers.players[0];
|
||||||
|
|
||||||
final removed = await database.playerMatchDao.removePlayerFromMatch(
|
final removed = await database.playerMatchDao.removePlayerFromMatch(
|
||||||
playerId: playerToRemove.id,
|
playerId: playerToRemove.id,
|
||||||
@@ -151,9 +151,9 @@ void main() {
|
|||||||
final result = await database.matchDao.getMatchById(
|
final result = await database.matchDao.getMatchById(
|
||||||
matchId: testMatchOnlyPlayers.id,
|
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,
|
(p) => p.id == playerToRemove.id,
|
||||||
);
|
);
|
||||||
expect(playerExists, false);
|
expect(playerExists, false);
|
||||||
@@ -164,18 +164,14 @@ void main() {
|
|||||||
await database.matchDao.addMatch(match: testMatchOnlyPlayers);
|
await database.matchDao.addMatch(match: testMatchOnlyPlayers);
|
||||||
final players = await database.playerMatchDao.getPlayersOfMatch(
|
final players = await database.playerMatchDao.getPlayersOfMatch(
|
||||||
matchId: testMatchOnlyPlayers.id,
|
matchId: testMatchOnlyPlayers.id,
|
||||||
);
|
) ?? [];
|
||||||
|
|
||||||
if (players == null) {
|
|
||||||
fail('Players should not be null');
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < players.length; i++) {
|
for (int i = 0; i < players.length; i++) {
|
||||||
expect(players[i].id, testMatchOnlyPlayers.players![i].id);
|
expect(players[i].id, testMatchOnlyPlayers.players[i].id);
|
||||||
expect(players[i].name, testMatchOnlyPlayers.players![i].name);
|
expect(players[i].name, testMatchOnlyPlayers.players[i].name);
|
||||||
expect(
|
expect(
|
||||||
players[i].createdAt,
|
players[i].createdAt,
|
||||||
testMatchOnlyPlayers.players![i].createdAt,
|
testMatchOnlyPlayers.players[i].createdAt,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user