Rank each player once across T5 and T6
This commit is contained in:
@@ -165,7 +165,7 @@ it('persists independent stat high-water marks without adding cumulative snapsho
|
||||
})]);
|
||||
});
|
||||
|
||||
it('retains per-game identities while combining the same GUID in one profile', async () => {
|
||||
it('combines the same GUID into one profile and ranking across games', async () => {
|
||||
await report('round_change', 8, [player(undefined, { kills: 111 })]);
|
||||
await report('game_end', 8, [player(undefined, { kills: 120, name: 'New name' })]);
|
||||
await report('game_start');
|
||||
@@ -182,14 +182,21 @@ it('retains per-game identities while combining the same GUID in one profile', a
|
||||
.toEqual({ total: 1 });
|
||||
closeDb();
|
||||
const { getPlayerProfile } = await import('../../src/lib/server/fleet/player-profile.js');
|
||||
const { getLeaderboard } = await import('../../src/lib/server/fleet/leaderboard.js');
|
||||
const profile = getPlayerProfile(player().guid)!;
|
||||
expect(profile).toMatchObject({ guid: player().guid, name: 'Other game',
|
||||
firstSeen: '2026-09-18T20:00:00.000Z', lastSeen: '2026-09-18T20:00:04.000Z',
|
||||
stats: { gamesPlayed: 3, gamesCompleted: 3, kills: 340, highestRound: 8, bestKills: 200, roundsSurvived: 1 } });
|
||||
expect(profile.matches.map(match => match.game)).toEqual(['t6', 't5', 't5']);
|
||||
const board = getLeaderboard();
|
||||
expect(board).toMatchObject({ total: 1, summary: { players: 1, matches: 3, kills: 340 } });
|
||||
expect(board.entries).toEqual([expect.objectContaining({ ...profile.stats, guid: player().guid, name: profile.name, rank: 1 })]);
|
||||
expect(getLeaderboard({ game: 't5' }).entries).toEqual([expect.objectContaining({ guid: player().guid, name: 'Other game', kills: 140, gamesPlayed: 2 })]);
|
||||
expect(getLeaderboard({ game: 't6' }).entries).toEqual([expect.objectContaining({ guid: player().guid, name: 'Other game', kills: 200, gamesPlayed: 1 })]);
|
||||
await report('game_start', 0, [player(undefined, { name: 'Live name' })]);
|
||||
expect(getPlayerProfile(player().guid)).toMatchObject({ name: 'Live name', lastSeen: '2026-09-18T20:00:05.000Z',
|
||||
stats: profile.stats, maps: profile.maps, matches: profile.matches });
|
||||
expect(getLeaderboard().entries).toEqual([expect.objectContaining({ ...profile.stats, name: 'Live name' })]);
|
||||
});
|
||||
|
||||
it('credits the highest round but only observed survival for a late join or a return after an absent roster', async () => {
|
||||
|
||||
Reference in New Issue
Block a user