- 新增客片案例全流程功能,包含前台页面、管理端配置、后端API、数据库迁移与文档 - 新增团队共创详情页面与对应接口 - 重构玩法模块:将静态playData替换为动态API获取,拆分类型定义到playTypes.ts - 优化vite构建配置与环境变量处理,调整详情页操作栏文案 - 更新全量相关文档与配图,新增客片案例、团队共创API文档 - 新增测试用例,完善数据归一化逻辑 - 调整路由配置与环境变量示例文件
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
||
import { normalizeConciergeAdvisors } from "@/pages/concierge/components/conciergeTypes";
|
||
|
||
describe("normalizeConciergeAdvisors", () => {
|
||
it("normalizes public advisor data and filters incomplete records", () => {
|
||
expect(
|
||
normalizeConciergeAdvisors({
|
||
advisors: [
|
||
{
|
||
id: "advisor-amanda",
|
||
avatar: " https://example.test/amanda.jpg ",
|
||
name: " Amanda ",
|
||
role: "SENIOR TRAVEL ADVISOR",
|
||
details: [
|
||
{ icon: " calendar ", label: " 服务经验:8年 " },
|
||
{ icon: "navigate", label: "" },
|
||
],
|
||
qrImage: "https://example.test/amanda-qr.png",
|
||
},
|
||
{ id: "missing-qr", avatar: "https://example.test/avatar.jpg", name: "无效", role: "ADVISOR", details: [] },
|
||
],
|
||
}),
|
||
).toEqual([
|
||
{
|
||
avatar: "https://example.test/amanda.jpg",
|
||
name: "Amanda",
|
||
role: "SENIOR TRAVEL ADVISOR",
|
||
details: [{ icon: "calendar", label: "服务经验:8年" }],
|
||
qrImage: "https://example.test/amanda-qr.png",
|
||
},
|
||
]);
|
||
});
|
||
|
||
it("returns an empty list for an invalid response", () => {
|
||
expect(normalizeConciergeAdvisors(null)).toEqual([]);
|
||
expect(normalizeConciergeAdvisors({ advisors: null })).toEqual([]);
|
||
});
|
||
});
|