fix: adjusted test
This commit is contained in:
@@ -261,28 +261,28 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('getMatchCount() works correctly', () async {
|
test('getMatchCount() works correctly', () async {
|
||||||
var matchCount = await database.matchDao.getMatchCount();
|
var count = await database.matchDao.getMatchCount();
|
||||||
expect(matchCount, 0);
|
expect(count, 0);
|
||||||
|
|
||||||
await database.matchDao.addMatch(match: testMatch1);
|
await database.matchDao.addMatch(match: testMatch1);
|
||||||
|
|
||||||
matchCount = await database.matchDao.getMatchCount();
|
count = await database.matchDao.getMatchCount();
|
||||||
expect(matchCount, 1);
|
expect(count, 1);
|
||||||
|
|
||||||
await database.matchDao.addMatch(match: testMatch2);
|
await database.matchDao.addMatch(match: testMatch2);
|
||||||
|
|
||||||
matchCount = await database.matchDao.getMatchCount();
|
count = await database.matchDao.getMatchCount();
|
||||||
expect(matchCount, 2);
|
expect(count, 2);
|
||||||
|
|
||||||
await database.matchDao.deleteMatch(matchId: testMatch1.id);
|
await database.matchDao.deleteMatch(matchId: testMatch1.id);
|
||||||
|
|
||||||
matchCount = await database.matchDao.getMatchCount();
|
count = await database.matchDao.getMatchCount();
|
||||||
expect(matchCount, 1);
|
expect(count, 1);
|
||||||
|
|
||||||
await database.matchDao.deleteMatch(matchId: testMatch2.id);
|
await database.matchDao.deleteMatch(matchId: testMatch2.id);
|
||||||
|
|
||||||
matchCount = await database.matchDao.getMatchCount();
|
count = await database.matchDao.getMatchCount();
|
||||||
expect(matchCount, 0);
|
expect(count, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getMatchCountByGame() works correctly', () async {
|
test('getMatchCountByGame() works correctly', () async {
|
||||||
@@ -302,6 +302,18 @@ void main() {
|
|||||||
gameId: testGame.id,
|
gameId: testGame.id,
|
||||||
);
|
);
|
||||||
expect(count, 2);
|
expect(count, 2);
|
||||||
|
|
||||||
|
await database.matchDao.deleteMatch(matchId: testMatch1.id);
|
||||||
|
count = await database.matchDao.getMatchCountByGame(
|
||||||
|
gameId: testGame.id,
|
||||||
|
);
|
||||||
|
expect(count, 1);
|
||||||
|
|
||||||
|
await database.matchDao.deleteMatch(matchId: testMatch2.id);
|
||||||
|
count = await database.matchDao.getMatchCountByGame(
|
||||||
|
gameId: testGame.id,
|
||||||
|
);
|
||||||
|
expect(count, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getMatchCountByGame() returns 0 for non-existent game', () async {
|
test('getMatchCountByGame() returns 0 for non-existent game', () async {
|
||||||
|
|||||||
Reference in New Issue
Block a user