feat: 新增客片案例与团队共创模块,重构玩法与配置
- 新增客片案例全流程功能,包含前台页面、管理端配置、后端API、数据库迁移与文档 - 新增团队共创详情页面与对应接口 - 重构玩法模块:将静态playData替换为动态API获取,拆分类型定义到playTypes.ts - 优化vite构建配置与环境变量处理,调整详情页操作栏文案 - 更新全量相关文档与配图,新增客片案例、团队共创API文档 - 新增测试用例,完善数据归一化逻辑 - 调整路由配置与环境变量示例文件
This commit is contained in:
1 parent
cda8069630
commit
7ba92f3c5d
76 files changed
+7970
-137
No files matched your search
@@ -0,0 +1,50 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { normalizePlayCategories } from "@/pages/play/components/playTypes";
|
||||
|
||||
describe("normalizePlayCategories", () => {
|
||||
it("normalizes the public response and ignores incomplete categories or routes", () => {
|
||||
expect(
|
||||
normalizePlayCategories({
|
||||
categories: [
|
||||
{
|
||||
id: "family-route",
|
||||
label: " 亲子路线 ",
|
||||
routes: [
|
||||
{
|
||||
id: "family-water",
|
||||
title: " 亲子玩水 ",
|
||||
subtitle: "贵州·轻松节奏与自然课堂",
|
||||
image: "https://example.test/family-water.jpg",
|
||||
routeCount: 4,
|
||||
demandKeyword: "亲子玩水",
|
||||
},
|
||||
{ id: "incomplete-route", title: "缺少图片" },
|
||||
],
|
||||
},
|
||||
{ id: "incomplete-category", label: "没有路线", routes: [] },
|
||||
{ id: "missing-label", routes: [{ id: "route", title: "无效" }] },
|
||||
],
|
||||
}),
|
||||
).toEqual([
|
||||
{
|
||||
id: "family-route",
|
||||
label: "亲子路线",
|
||||
routes: [
|
||||
{
|
||||
id: "family-water",
|
||||
title: "亲子玩水",
|
||||
subtitle: "贵州·轻松节奏与自然课堂",
|
||||
image: "https://example.test/family-water.jpg",
|
||||
routeCount: 4,
|
||||
demandKeyword: "亲子玩水",
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("returns an empty list for an invalid public response", () => {
|
||||
expect(normalizePlayCategories({ categories: null })).toEqual([]);
|
||||
expect(normalizePlayCategories(null)).toEqual([]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user