fix(jump-hop): isolate draft runs from public leaderboard
This commit is contained in:
@@ -278,7 +278,7 @@ test('跳一跳运行态失败后在弹窗中展示排行榜', () => {
|
||||
|
||||
render(
|
||||
<JumpHopRuntimeShell
|
||||
profile={buildProfile()}
|
||||
profile={buildProfile({ publicationStatus: 'published' })}
|
||||
run={buildFailedRun()}
|
||||
runtimeRequestOptions={runtimeRequestOptions}
|
||||
onJump={vi.fn().mockResolvedValue(undefined)}
|
||||
@@ -298,6 +298,21 @@ test('跳一跳运行态失败后在弹窗中展示排行榜', () => {
|
||||
expect(within(leaderboard).getByText('00:08')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('跳一跳草稿运行失败后不请求公开排行榜', () => {
|
||||
render(
|
||||
<JumpHopRuntimeShell
|
||||
profile={buildProfile({ publicationStatus: 'draft' })}
|
||||
run={buildFailedRun()}
|
||||
onJump={vi.fn().mockResolvedValue(undefined)}
|
||||
onRestart={() => {}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(useJumpHopLeaderboard).not.toHaveBeenCalled();
|
||||
expect(screen.getByRole('dialog', { name: '失败' })).toBeTruthy();
|
||||
expect(screen.queryByTestId('jump-hop-runtime-leaderboard')).toBeNull();
|
||||
});
|
||||
|
||||
test('跳一跳角色层永远压在地块层之上', () => {
|
||||
render(
|
||||
<JumpHopRuntimeShell
|
||||
@@ -943,6 +958,7 @@ function buildProfile(options: {
|
||||
tileAssets?: JumpHopWorkProfileResponse['tileAssets'];
|
||||
coverComposite?: string | null;
|
||||
coverImageSrc?: string | null;
|
||||
publicationStatus?: JumpHopWorkProfileResponse['summary']['publicationStatus'];
|
||||
} = {}): JumpHopWorkProfileResponse {
|
||||
const characterAsset = {
|
||||
assetId: 'builtin',
|
||||
@@ -968,7 +984,7 @@ function buildProfile(options: {
|
||||
difficulty: 'standard',
|
||||
stylePreset: 'minimal-blocks',
|
||||
coverImageSrc: options.coverImageSrc ?? null,
|
||||
publicationStatus: 'draft',
|
||||
publicationStatus: options.publicationStatus ?? 'draft',
|
||||
playCount: 0,
|
||||
updatedAt: '2026-05-27T00:00:00Z',
|
||||
publishedAt: null,
|
||||
|
||||
Reference in New Issue
Block a user