feat(viewer): album page with locale fallback and timezone display
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import type { PublicAlbum } from '../api/client';
|
||||
|
||||
// 组件测试共享夹具:公开相册响应的最小完整形状(对齐契约 PublicAlbum 必返字段)。
|
||||
// vi.mock 工厂需在各 spec 文件内联(hoisting 限制),此处只承载数据构造。
|
||||
export function makeAlbum(
|
||||
overrides: Partial<PublicAlbum> & { translation?: Partial<PublicAlbum['translation']> } = {},
|
||||
): PublicAlbum {
|
||||
const { translation, ...rest } = overrides;
|
||||
return {
|
||||
publicToken: 'tokfixture0000000000aaaa',
|
||||
resolvedLocale: 'zh-CN',
|
||||
defaultLocale: 'zh-CN',
|
||||
timezone: 'Asia/Shanghai',
|
||||
startAt: '2026-10-01T02:00:00.000Z',
|
||||
endAt: '2026-10-01T12:00:00.000Z',
|
||||
translation: {
|
||||
locale: 'zh-CN',
|
||||
title: '2026 公司年会',
|
||||
description: '年度盛会\n多行介绍',
|
||||
venue: '大宴会厅',
|
||||
address: '上海市浦东新区世纪大道 100 号',
|
||||
...translation,
|
||||
},
|
||||
categories: [
|
||||
{ id: 'cat-sign', name: '签到墙', sortOrder: 0 },
|
||||
{ id: 'cat-open', name: '开场', sortOrder: 1 },
|
||||
],
|
||||
banner: null,
|
||||
viewCount: null,
|
||||
...rest,
|
||||
};
|
||||
}
|
||||
|
||||
export function makeEnAlbum(): PublicAlbum {
|
||||
return makeAlbum({
|
||||
resolvedLocale: 'en',
|
||||
translation: {
|
||||
locale: 'en',
|
||||
title: 'Annual Party 2026',
|
||||
description: 'Yearly gala',
|
||||
venue: 'Grand Ballroom',
|
||||
address: '100 Century Ave, Pudong, Shanghai',
|
||||
},
|
||||
categories: [
|
||||
{ id: 'cat-sign', name: 'Check-in Wall', sortOrder: 0 },
|
||||
{ id: 'cat-open', name: 'Opening', sortOrder: 1 },
|
||||
],
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user