Updated score and winner handling
This commit is contained in:
@@ -63,7 +63,6 @@ void main() {
|
||||
game: testGame,
|
||||
group: testGroup1,
|
||||
players: [testPlayer4, testPlayer5],
|
||||
winner: testPlayer4,
|
||||
notes: '',
|
||||
);
|
||||
testMatch2 = Match(
|
||||
@@ -71,20 +70,19 @@ void main() {
|
||||
game: testGame,
|
||||
group: testGroup2,
|
||||
players: [testPlayer1, testPlayer2, testPlayer3],
|
||||
winner: testPlayer2,
|
||||
notes: '',
|
||||
);
|
||||
testMatchOnlyPlayers = Match(
|
||||
name: 'Test Match with Players',
|
||||
game: testGame,
|
||||
players: [testPlayer1, testPlayer2, testPlayer3],
|
||||
winner: testPlayer3,
|
||||
notes: '',
|
||||
);
|
||||
testMatchOnlyGroup = Match(
|
||||
name: 'Test Match with Group',
|
||||
game: testGame,
|
||||
group: testGroup2,
|
||||
players: testGroup2.members,
|
||||
notes: '',
|
||||
);
|
||||
});
|
||||
@@ -289,8 +287,8 @@ void main() {
|
||||
matchId: testMatch1.id,
|
||||
);
|
||||
|
||||
expect(fetchedMatch.winner, isNotNull);
|
||||
expect(fetchedMatch.winner!.id, testPlayer4.id);
|
||||
expect(fetchedMatch.mvp, isNotNull);
|
||||
expect(fetchedMatch.mvp.first.id, testPlayer4.id);
|
||||
});
|
||||
|
||||
test('Setting a winner works correctly', () async {
|
||||
@@ -304,8 +302,8 @@ void main() {
|
||||
final fetchedMatch = await database.matchDao.getMatchById(
|
||||
matchId: testMatch1.id,
|
||||
);
|
||||
expect(fetchedMatch.winner, isNotNull);
|
||||
expect(fetchedMatch.winner!.id, testPlayer5.id);
|
||||
expect(fetchedMatch.mvp, isNotNull);
|
||||
expect(fetchedMatch.mvp.first.id, testPlayer5.id);
|
||||
});
|
||||
|
||||
test(
|
||||
|
||||
@@ -343,8 +343,16 @@ void main() {
|
||||
// Verifies that teams with overlapping members are independent.
|
||||
test('Teams with overlapping members are independent', () async {
|
||||
// Create two matches since player_match has primary key {playerId, matchId}
|
||||
final match1 = Match(name: 'Match 1', game: testGame1, notes: '');
|
||||
final match2 = Match(name: 'Match 2', game: testGame2, notes: '');
|
||||
final match1 = Match(
|
||||
name: 'Match 1',
|
||||
game: testGame1,
|
||||
players: [testPlayer1, testPlayer2],
|
||||
);
|
||||
final match2 = Match(
|
||||
name: 'Match 2',
|
||||
game: testGame2,
|
||||
players: [testPlayer1, testPlayer2],
|
||||
);
|
||||
await database.matchDao.addMatch(match: match1);
|
||||
await database.matchDao.addMatch(match: match2);
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ void main() {
|
||||
testMatchOnlyGroup = Match(
|
||||
name: 'Test Match with Group',
|
||||
game: testGame,
|
||||
players: testGroup.members,
|
||||
group: testGroup,
|
||||
notes: '',
|
||||
);
|
||||
|
||||
@@ -231,8 +231,8 @@ void main() {
|
||||
);
|
||||
|
||||
expect(scores.length, 2);
|
||||
expect(scores[testPlayer1.id]!.length, 2);
|
||||
expect(scores[testPlayer2.id]!.length, 1);
|
||||
expect(scores[testPlayer1.id]!, isNotNull);
|
||||
expect(scores[testPlayer2.id]!, isNotNull);
|
||||
});
|
||||
|
||||
test('getAllMatchScores() with no scores saved', () async {
|
||||
|
||||
Reference in New Issue
Block a user