2026-09-18 09:52:22 +08:00
|
|
|
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,
|
2026-09-20 18:32:34 +08:00
|
|
|
// P4a Task 4:下载两级开关(契约 PublicAlbum 必返字段;缺省 on/off)。
|
|
|
|
|
downloadEnabled: true,
|
|
|
|
|
originalDownloadEnabled: false,
|
2026-09-18 09:52:22 +08:00
|
|
|
...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 },
|
|
|
|
|
],
|
|
|
|
|
});
|
|
|
|
|
}
|