Focus player records and add squad leaderboards
This commit is contained in:
@@ -22,11 +22,22 @@ describe('leaderboard profile navigation', () => {
|
||||
expect(next.searchParams.get('map')).toBe('t5:theater');
|
||||
const filtered = new URL(profileViewHref(current, { game: 't6', map: '' }), current);
|
||||
expect(filtered.searchParams.has('offset')).toBe(false);
|
||||
expect(filtered.searchParams.has('map')).toBe(false);
|
||||
expect(filtered.searchParams.get('map')).toBe('');
|
||||
expect(filtered.searchParams.get('game')).toBe('t6');
|
||||
expect(filtered.searchParams.get('returnTo')).toBe('/leaderboard?q=Ace');
|
||||
});
|
||||
|
||||
it('preserves explicit all maps and squad scope through profile links and paging', () => {
|
||||
const source = '/leaderboard?map=&players=2&metric=highestRound';
|
||||
expect(leaderboardReturnHref(source)).toBe(source);
|
||||
const profile = new URL(playerContextHref('101', source), 'http://localhost');
|
||||
expect(profile.searchParams.get('map')).toBe('');
|
||||
expect(profile.searchParams.get('players')).toBe('2');
|
||||
const next = new URL(profileViewHref(profile, { offset: '25' }), profile);
|
||||
expect(next.searchParams.get('map')).toBe('');
|
||||
expect(next.searchParams.get('players')).toBe('2');
|
||||
});
|
||||
|
||||
it('restricts supplied return destinations to the local leaderboard', () => {
|
||||
for (const value of [null, '', 'https://example.com/leaderboard', '//example.com/leaderboard', '/leaderboard/players/101', '/leaderboard/../settings', '/leaderboard\\@example.com']) {
|
||||
expect(leaderboardReturnHref(value)).toBe('/leaderboard');
|
||||
|
||||
Reference in New Issue
Block a user