refactor: 收口公开作品展示格式
This commit is contained in:
@@ -3,8 +3,10 @@ import { expect, test } from 'vitest';
|
||||
import {
|
||||
buildPlatformWorldDisplayTags,
|
||||
buildPuzzleWorkCoverSlides,
|
||||
describePlatformPublicWorkKind,
|
||||
EDUTAINMENT_BABY_OBJECT_MATCH_TEMPLATE_ID,
|
||||
EDUTAINMENT_BABY_OBJECT_MATCH_TEMPLATE_NAME,
|
||||
formatPlatformCompactCount,
|
||||
formatPlatformWorkDisplayName,
|
||||
formatPlatformWorkDisplayTags,
|
||||
formatPlatformWorldTime,
|
||||
@@ -16,10 +18,11 @@ import {
|
||||
mapBarkBattleWorkToPlatformGalleryCard,
|
||||
mapVisualNovelWorkToPlatformGalleryCard,
|
||||
mapWoodenFishWorkToPlatformGalleryCard,
|
||||
type PlatformBigFishGalleryCard,
|
||||
type PlatformEdutainmentGalleryCard,
|
||||
type PlatformPuzzleGalleryCard,
|
||||
resolvePlatformWorkAuthorDisplayName,
|
||||
resolvePlatformPublicWorkCode,
|
||||
resolvePlatformWorkAuthorDisplayName,
|
||||
resolvePlatformWorldFallbackCoverImage,
|
||||
} from './rpgEntryWorldPresentation';
|
||||
|
||||
@@ -53,6 +56,48 @@ test('platform work display text limits names and tags by character count', () =
|
||||
).toEqual(['超长机关', '星桥']);
|
||||
});
|
||||
|
||||
test('platform public work presentation formats compact counts and kind labels', () => {
|
||||
const puzzleCard: PlatformPuzzleGalleryCard = {
|
||||
sourceType: 'puzzle',
|
||||
workId: 'puzzle-work-kind',
|
||||
profileId: 'puzzle-profile-kind',
|
||||
publicWorkCode: 'PZ-KIND',
|
||||
ownerUserId: 'user-1',
|
||||
authorDisplayName: '玩家',
|
||||
worldName: '机关拼图',
|
||||
subtitle: '拼图关卡',
|
||||
summaryText: '公开作品',
|
||||
coverImageSrc: null,
|
||||
themeTags: ['拼图'],
|
||||
visibility: 'published',
|
||||
publishedAt: '2026-05-18T00:00:00.000Z',
|
||||
updatedAt: '2026-05-18T00:00:00.000Z',
|
||||
};
|
||||
const bigFishCard: PlatformBigFishGalleryCard = {
|
||||
sourceType: 'big-fish',
|
||||
workId: 'big-fish-work-kind',
|
||||
profileId: 'big-fish-profile-kind',
|
||||
publicWorkCode: 'BF-KIND',
|
||||
ownerUserId: 'user-1',
|
||||
authorDisplayName: '玩家',
|
||||
worldName: '大鱼海湾',
|
||||
subtitle: '大鱼关卡',
|
||||
summaryText: '公开作品',
|
||||
coverImageSrc: null,
|
||||
themeTags: ['大鱼'],
|
||||
visibility: 'published',
|
||||
publishedAt: '2026-05-18T00:00:00.000Z',
|
||||
updatedAt: '2026-05-18T00:00:00.000Z',
|
||||
};
|
||||
|
||||
expect(formatPlatformCompactCount(-1)).toBe('0');
|
||||
expect(formatPlatformCompactCount(9999)).toBe('9999');
|
||||
expect(formatPlatformCompactCount(10000)).toBe('1.0万');
|
||||
expect(formatPlatformCompactCount(100000000)).toBe('1.0亿');
|
||||
expect(describePlatformPublicWorkKind(puzzleCard)).toBe('拼图');
|
||||
expect(describePlatformPublicWorkKind(bigFishCard)).toBe('大鱼吃小');
|
||||
});
|
||||
|
||||
test('platform public cards use play type reference images as cover fallback', () => {
|
||||
const puzzleCard: PlatformPuzzleGalleryCard = {
|
||||
sourceType: 'puzzle',
|
||||
|
||||
Reference in New Issue
Block a user