Default leaderboard to all maps

This commit is contained in:
2026-10-08 00:22:10 -04:00
parent 2f67482521
commit b42cbf1894
5 changed files with 14 additions and 61 deletions
-13
View File
@@ -67,19 +67,6 @@ describe('leaderboard starting-player scopes', () => {
scope: { players: '2', entry: { gamesPlayed: 30, highestRound: 20, records: { highestRound: { matchId: 1 } } } } });
});
it('chooses a deterministic usable default map within game and squad, ignoring unfinished and statless records', async () => {
const { db } = await import('../../src/lib/server/db/index.js');
seed(db(), 1, 2); seed(db(), 2, 3, { map: 'moon', mapName: 'Moon' });
seed(db(), 3, 4, { game: 't6', map: 'town', mapName: 'Town' });
seed(db(), 4, 2, { map: 'empty', mapName: 'A statless map', hasStats: 0 });
seed(db(), 5, 2, { map: 'active', mapName: 'A match in progress', status: 'active' });
const { defaultLeaderboardMap } = await import('../../src/lib/server/fleet/leaderboard.js');
expect(defaultLeaderboardMap()).toBe('t5:theater');
expect(defaultLeaderboardMap({ players: 3 })).toBe('t5:moon');
expect(defaultLeaderboardMap({ game: 't6' })).toBe('t6:town');
expect(defaultLeaderboardMap({ game: 't5', players: 4 })).toBeNull();
});
it('keeps API absent-map searches global while filtering all contributions by the selected squad', async () => {
const { db } = await import('../../src/lib/server/db/index.js');
seed(db(), 1, 2); seed(db(), 2, 2, { map: 'moon', mapName: 'Moon' }); seed(db(), 3, null, { round: 99 });