Reordered tests
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 45s
Pull Request Pipeline / lint (pull_request) Successful in 47s

This commit is contained in:
2026-05-05 11:45:22 +02:00
parent eadf05e116
commit f3380e6c08

View File

@@ -259,6 +259,57 @@ void main() {
expect(match.group, isNotNull);
expect(match.group!.id, testGroup1.id);
});
test('getMatchCount() works correctly', () async {
var matchCount = await database.matchDao.getMatchCount();
expect(matchCount, 0);
await database.matchDao.addMatch(match: testMatch1);
matchCount = await database.matchDao.getMatchCount();
expect(matchCount, 1);
await database.matchDao.addMatch(match: testMatch2);
matchCount = await database.matchDao.getMatchCount();
expect(matchCount, 2);
await database.matchDao.deleteMatch(matchId: testMatch1.id);
matchCount = await database.matchDao.getMatchCount();
expect(matchCount, 1);
await database.matchDao.deleteMatch(matchId: testMatch2.id);
matchCount = await database.matchDao.getMatchCount();
expect(matchCount, 0);
});
test('getMatchCountByGame() works correctly', () async {
var count = await database.matchDao.getMatchCountByGame(
gameId: testGame.id,
);
expect(count, 0);
await database.matchDao.addMatch(match: testMatch1);
count = await database.matchDao.getMatchCountByGame(
gameId: testGame.id,
);
expect(count, 1);
await database.matchDao.addMatch(match: testMatch2);
count = await database.matchDao.getMatchCountByGame(
gameId: testGame.id,
);
expect(count, 2);
});
test('getMatchCountByGame() returns 0 for non-existent game', () async {
final count = await database.matchDao.getMatchCountByGame(
gameId: 'non-existent-game-id',
);
expect(count, 0);
});
});
group('UPDATE', () {
@@ -408,31 +459,6 @@ void main() {
final allMatches = await database.matchDao.getAllMatches();
expect(allMatches, isEmpty);
});
test('Getting the match count works correctly', () async {
var matchCount = await database.matchDao.getMatchCount();
expect(matchCount, 0);
await database.matchDao.addMatch(match: testMatch1);
matchCount = await database.matchDao.getMatchCount();
expect(matchCount, 1);
await database.matchDao.addMatch(match: testMatch2);
matchCount = await database.matchDao.getMatchCount();
expect(matchCount, 2);
await database.matchDao.deleteMatch(matchId: testMatch1.id);
matchCount = await database.matchDao.getMatchCount();
expect(matchCount, 1);
await database.matchDao.deleteMatch(matchId: testMatch2.id);
matchCount = await database.matchDao.getMatchCount();
expect(matchCount, 0);
});
});
group('DELETE', () {
@@ -472,28 +498,6 @@ void main() {
});
});
test('getMatchCountByGame() works correctly', () async {
var count = await database.matchDao.getMatchCountByGame(
gameId: testGame.id,
);
expect(count, 0);
await database.matchDao.addMatch(match: testMatch1);
count = await database.matchDao.getMatchCountByGame(gameId: testGame.id);
expect(count, 1);
await database.matchDao.addMatch(match: testMatch2);
count = await database.matchDao.getMatchCountByGame(gameId: testGame.id);
expect(count, 2);
});
test('getMatchCountByGame() returns 0 for non-existent game', () async {
final count = await database.matchDao.getMatchCountByGame(
gameId: 'non-existent-game-id',
);
expect(count, 0);
});
test('deleteMatchesByGame() deletes all matches for a game', () async {
await database.matchDao.addMatch(match: testMatch1);
await database.matchDao.addMatch(match: testMatch2);