修正跳一跳排行榜展示名
新增排行榜 displayName 契约并在 api-server 出口补齐展示名 调整跳一跳结果页和运行态排行榜只显示 displayName 补充禁止展示 user_id 的前后端回归测试 更新跳一跳 PRD、后端契约文档和 Hermes 决策记录
This commit is contained in:
@@ -28,14 +28,16 @@ test('跳一跳结果页展示排行榜列表', () => {
|
||||
items: [
|
||||
{
|
||||
rank: 1,
|
||||
playerId: 'player-1',
|
||||
playerId: 'user-secret-1',
|
||||
displayName: '陶泥儿玩家',
|
||||
successfulJumpCount: 12,
|
||||
durationMs: 40123,
|
||||
updatedAt: '2026-05-27T00:00:00Z',
|
||||
},
|
||||
{
|
||||
rank: 2,
|
||||
playerId: 'player-2',
|
||||
playerId: 'user-secret-2',
|
||||
displayName: '森林玩家',
|
||||
successfulJumpCount: 10,
|
||||
durationMs: 38210,
|
||||
updatedAt: '2026-05-26T00:00:00Z',
|
||||
@@ -60,10 +62,12 @@ test('跳一跳结果页展示排行榜列表', () => {
|
||||
);
|
||||
|
||||
expect(screen.getByText('排行榜')).toBeTruthy();
|
||||
expect(screen.getByText('player-1')).toBeTruthy();
|
||||
expect(screen.getByText('陶泥儿玩家')).toBeTruthy();
|
||||
expect(screen.queryByText('user-secret-1')).toBeNull();
|
||||
expect(screen.getByText('12 跳')).toBeTruthy();
|
||||
expect(screen.getByText('00:40')).toBeTruthy();
|
||||
expect(screen.getByText('player-2')).toBeTruthy();
|
||||
expect(screen.getByText('森林玩家')).toBeTruthy();
|
||||
expect(screen.queryByText('user-secret-2')).toBeNull();
|
||||
});
|
||||
|
||||
test('跳一跳结果页默认角色预览使用陶泥儿透明 logo', () => {
|
||||
|
||||
@@ -231,7 +231,9 @@ function JumpHopResultLeaderboard({
|
||||
<span className="text-[var(--platform-text-soft)]">
|
||||
{entry.rank}
|
||||
</span>
|
||||
<span className="truncate">{entry.playerId}</span>
|
||||
<span className="truncate">
|
||||
{entry.displayName?.trim() || '玩家'}
|
||||
</span>
|
||||
<span>{entry.successfulJumpCount} 跳</span>
|
||||
<span>{formatJumpHopDurationLabel(entry.durationMs)}</span>
|
||||
</div>
|
||||
|
||||
@@ -327,7 +327,8 @@ test('跳一跳运行态失败后在弹窗中展示排行榜', () => {
|
||||
items: [
|
||||
{
|
||||
rank: 1,
|
||||
playerId: 'player-1',
|
||||
playerId: 'user-secret-1',
|
||||
displayName: '陶泥儿玩家',
|
||||
successfulJumpCount: 8,
|
||||
durationMs: 8123,
|
||||
updatedAt: '2026-05-27T00:00:00Z',
|
||||
@@ -357,7 +358,8 @@ test('跳一跳运行态失败后在弹窗中展示排行榜', () => {
|
||||
expect(screen.getByRole('dialog', { name: '失败' })).toBeTruthy();
|
||||
const leaderboard = screen.getByTestId('jump-hop-runtime-leaderboard');
|
||||
expect(leaderboard).toBeTruthy();
|
||||
expect(within(leaderboard).getByText('player-1')).toBeTruthy();
|
||||
expect(within(leaderboard).getByText('陶泥儿玩家')).toBeTruthy();
|
||||
expect(within(leaderboard).queryByText('user-secret-1')).toBeNull();
|
||||
expect(within(leaderboard).getByText('8 跳')).toBeTruthy();
|
||||
expect(within(leaderboard).getByText('00:08')).toBeTruthy();
|
||||
});
|
||||
|
||||
@@ -548,7 +548,9 @@ function JumpHopLeaderboardPanel({
|
||||
className="grid grid-cols-[1.5rem_minmax(0,1fr)_auto_auto] items-center gap-2 text-xs font-bold text-slate-700"
|
||||
>
|
||||
<span className="text-slate-400">{entry.rank}</span>
|
||||
<span className="truncate">{entry.playerId}</span>
|
||||
<span className="truncate">
|
||||
{entry.displayName?.trim() || '玩家'}
|
||||
</span>
|
||||
<span>{entry.successfulJumpCount} 跳</span>
|
||||
<span>{formatJumpHopDurationLabel(entry.durationMs)}</span>
|
||||
</div>
|
||||
|
||||
@@ -30,6 +30,7 @@ const leaderboardResponse: JumpHopLeaderboardResponse = {
|
||||
{
|
||||
rank: 1,
|
||||
playerId: 'player-1',
|
||||
displayName: '玩家一号',
|
||||
successfulJumpCount: 10,
|
||||
durationMs: 3210,
|
||||
updatedAt: '2026-05-27T00:00:00Z',
|
||||
|
||||
Reference in New Issue
Block a user