Download tests/export.test.ts from hongcoding/agentlens: direct link, hf CLI and curl.
- Browser
- Download file 1.65 kB
-
https://huggingface.co/datasets/hongcoding/agentlens/resolve/main/tests/export.test.ts
- Command line
-
hf download hf://datasets/hongcoding/agentlens/tests/export.test.ts
-
curl -L -o export.test.ts https://huggingface.co/datasets/hongcoding/agentlens/resolve/main/tests/export.test.ts
1.65 kB
| import { describe, it, expect } from "vitest"; | |
| import { renderPersonas, renderModels } from "../src/export/dsh.js"; | |
| import type { Persona } from "../src/export/dsh.js"; | |
| const personas: Persona[] = [ | |
| { id: "a", name: "Chief", role: "总管", model: "deepseek-flash", color: "deepseek", avatar: '{"shape":"whale"}', instructions: "你是 Chief,总管。" }, | |
| { id: "b", name: "代码 bot", role: "代码", instructions: "你是代码 Bot。" }, | |
| ]; | |
| describe("renderPersonas", () => { | |
| it("renders every persona with metadata and instructions", () => { | |
| const md = renderPersonas(personas); | |
| expect(md).toContain("# 人设档案"); | |
| expect(md).toContain("## Chief"); | |
| expect(md).toContain("- 角色:总管"); | |
| expect(md).toContain("- 模型:deepseek-flash"); | |
| expect(md).toContain("你是 Chief,总管。"); | |
| expect(md).toContain("## 代码 bot"); | |
| expect(md).toContain("你是代码 Bot。"); | |
| }); | |
| it("handles empty persona list", () => { | |
| const md = renderPersonas([]); | |
| expect(md).toContain("# 人设档案"); | |
| }); | |
| }); | |
| describe("renderModels", () => { | |
| it("renders a model table with effort", () => { | |
| const md = renderModels([ | |
| { id: "a", name: "Chief", role: "总管", model: "deepseek-flash", effort: "high", instructions: "x" }, | |
| { id: "b", name: "代码 bot", role: "代码", model: "xiaomi/mimo-v2.6-pro", instructions: "y" }, | |
| ]); | |
| expect(md).toContain("# 模型配置"); | |
| expect(md).toContain("| Chief | 总管 | deepseek-flash | high |"); | |
| expect(md).toContain("| 代码 bot | 代码 | xiaomi/mimo-v2.6-pro | - |"); | |
| expect(md).toContain("deepseek-flash"); | |
| }); | |
| }); | |