审核详情价格改用待审版本冻结价
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled

- applyFrozenGameMetadata 叠加冻结资料中的数值型 priceMudPoints:价格随版本冻结,审核员要看到待审版本将要生效的价格,而不是游戏行当前已公开价格
- 冻结资料缺 priceMudPoints 或为旧响应时保留 game.priceMudPoints,详情资料区仍渲染 detail.game.priceMudPoints
- 新增两条详情用例:游戏行 0 泥点但冻结 30 泥点时展示「30 泥点」;旧版本冻结资料无价格时回落「免费」且不出现 NaN
This commit is contained in:
2026-10-05 16:49:52 +08:00
parent 4d7cd98dc6
commit d27e204f21
2 changed files with 59 additions and 0 deletions
@@ -17,6 +17,7 @@ import {
reviewAdminGameDistributionVersion,
} from '../api/adminApiClient';
import type {
AdminGameDistributionGameDetail,
AdminGameDistributionGameListResponse,
AdminGameDistributionReviewEntry,
AdminGameDistributionVersionDetailResponse,
@@ -365,3 +366,56 @@ test('详情展示发布者和冻结资料,并试玩当前待审版本', async
),
);
});
test('详情优先展示待审版本冻结价格,而不是游戏行当前价格', async () => {
vi.mocked(getAdminGameDistributionVersion).mockResolvedValue({
// 游戏行当前是免费,待审版本冻结为 30 泥点:审核员要看到将要生效的价格。
game: { ...detailResponse.game, priceMudPoints: 0 },
version: {
...detailResponse.version,
frozenMetadata: { title: '测试游戏', priceMudPoints: 30 },
},
});
render(
<AdminGameDistributionReviewPage
token="admin-token"
onUnauthorized={vi.fn()}
/>,
);
await screen.findByText(gameTitle);
fireEvent.click(screen.getByRole('button', { name: '详情' }));
expect((await screen.findAllByText(/测试作者/u)).length).toBeGreaterThan(0);
expect(screen.getByText('价格')).toBeTruthy();
expect(screen.getByText('30 泥点')).toBeTruthy();
expect(screen.queryByText('免费')).toBeNull();
});
test('旧版本冻结资料没有价格时按免费回落', async () => {
vi.mocked(getAdminGameDistributionVersion).mockResolvedValue({
game: {
...detailResponse.game,
priceMudPoints: undefined,
} as unknown as AdminGameDistributionGameDetail,
version: {
...detailResponse.version,
frozenMetadata: { title: '测试游戏' },
},
});
render(
<AdminGameDistributionReviewPage
token="admin-token"
onUnauthorized={vi.fn()}
/>,
);
await screen.findByText(gameTitle);
fireEvent.click(screen.getByRole('button', { name: '详情' }));
expect((await screen.findAllByText(/测试作者/u)).length).toBeGreaterThan(0);
expect(screen.getByText('免费')).toBeTruthy();
expect(screen.queryByText(/NaN/u)).toBeNull();
});
@@ -98,6 +98,11 @@ function applyFrozenGameMetadata(
typeof metadata.orientation === 'string'
? metadata.orientation
: game.orientation,
// 价格随版本冻结:审核页要展示待审版本将要生效的价格,而不是游戏行当前已公开价格。
priceMudPoints:
typeof metadata.priceMudPoints === 'number'
? metadata.priceMudPoints
: game.priceMudPoints,
};
}