Files
ttstd-infinite-canvas/web/test/welcome-contributors.test.ts
ddCat 6892732b06 feat(agent): Agent 工作台 - 计划插话记忆、统一模型选择器并修复摘要与视频入库
将计划清单、运行中插话和个人记忆接入云端 Agent;全站模型选择器统一为左右二级菜单。画布摘要按预算截断不再整轮拒绝,首页视频未知宽高可入库。README 补充贡献者 morrow。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 20:21:25 +08:00

56 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { parseContributors } from "../src/pages/welcome/contributors-parse";
const identityAvatar = (path: string) => path;
test("welcome contributors parse the README HTML table", () => {
const readme = readFileSync(resolve(import.meta.dir, "../../README.md"), "utf8");
const people = parseContributors(readme, identityAvatar);
expect(people.length).toBeGreaterThanOrEqual(20);
expect(people[0]).toMatchObject({
name: "ddCat",
avatar: "assets/user-ddcat.jpg",
email: "ddcat666@126.com",
wechat: "ddcat0829",
isFounder: true,
});
expect(people[0]?.signature).toContain("没有任何黑魔法");
expect(people.some((person) => person.name === "爱笑的毛毛虫")).toBe(true);
expect(people.some((person) => person.name === "morrow" && person.email === "3201190041@qq.com" && person.signature === "最难不过坚持")).toBe(true);
expect(people.filter((person) => person.isFounder)).toHaveLength(1);
});
test("welcome contributors still parse markdown pipe tables", () => {
const markdown = `## 贡献者与团队
| 头像 | 昵称 | 邮箱 | 签名 |
| --- | --- | --- | --- |
| <img src="assets/user-ddcat.jpg" alt="ddCat"> | ddCat<br>项目发起者 · 微信:ddcat0829 | founder@example.com | 把故事搬上银幕 |
| <img src="assets/user-ken.jpg" alt="ken"> | ken | ken@example.com | 走自己的路 |
## 下一章
`;
expect(parseContributors(markdown, identityAvatar)).toEqual([
{
name: "ddCat",
avatar: "assets/user-ddcat.jpg",
signature: "把故事搬上银幕",
email: "founder@example.com",
wechat: "ddcat0829",
isFounder: true,
},
{
name: "ken",
avatar: "assets/user-ken.jpg",
signature: "走自己的路",
email: "ken@example.com",
wechat: undefined,
isFounder: false,
},
]);
});