Exclude same-round departures from games played
This commit is contained in:
@@ -387,6 +387,14 @@ describe('player profiles', () => {
|
||||
for (const offset of [-1, NaN, 0.5]) expect(getPlayerProfile('101', offset)?.offset).toBe(0);
|
||||
const { load } = await import('../../src/routes/leaderboard/players/[guid]/+page.server.js');
|
||||
expect((await load({ params: { guid: '101' }, url: new URL('http://localhost/leaderboard/players/101?offset=25') })).profile).toEqual(second);
|
||||
|
||||
// Historical same-round departures retain both pages even with no counted games.
|
||||
handle.prepare(`UPDATE leaderboard_match_players SET first_observed_round = highest_round,
|
||||
completed = 0 WHERE guid = '101'`).run();
|
||||
const departures = getPlayerProfile('101', 25)!;
|
||||
expect(departures).toMatchObject({ stats: { gamesPlayed: 0, kills: 770 }, matchesTotal: 34, offset: 25 });
|
||||
expect(departures.matches).toHaveLength(9);
|
||||
expect(departures.maps.every(map => map.gamesPlayed === 0)).toBe(true);
|
||||
});
|
||||
|
||||
it('loads canonical profile URLs, encodes GUIDs and returns 404 for missing players', async () => {
|
||||
|
||||
Reference in New Issue
Block a user