capabilityMapCurrentFeatures.test.ts 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { describe, expect, it } from "vitest";
  2. import { capabilityEdges, capabilityNodes } from "@/data/productCapabilityMap.js";
  3. function node(id: string) {
  4. const result = capabilityNodes.find((candidate) => candidate.id === id);
  5. expect(result, `能力节点 ${id} 应存在`).toBeDefined();
  6. return result!;
  7. }
  8. function edge(source: string, target: string) {
  9. const result = capabilityEdges.find(
  10. (candidate) => candidate.source === source && candidate.target === target,
  11. );
  12. expect(result, `能力边 ${source} -> ${target} 应存在`).toBeDefined();
  13. return result!;
  14. }
  15. describe("能力地图当前功能事实", () => {
  16. it("记录 Office 只读预览与未来原生编辑的边界", () => {
  17. expect(node("office-document-preview").scope).toEqual(expect.stringContaining("DOCX/DOC"));
  18. expect(node("office-document-preview").scope).toEqual(expect.stringContaining("XLSX"));
  19. expect(edge("office-document-preview", "file-service")).toMatchObject({
  20. type: "delivery",
  21. });
  22. });
  23. it("记录视频媒体、Hook 摘要和 /plan 的对话入口", () => {
  24. expect(node("sent-media-preview").scope).toMatch(/image\/video|视频/);
  25. expect(node("hook-turn-summary").scope).toContain("client-visible");
  26. expect(node("plan-shortcut").scope).toContain("/plan");
  27. expect(edge("product-projection", "hook-turn-summary")).toMatchObject({
  28. type: "state",
  29. });
  30. expect(edge("hook-turn-summary", "desktop-continuous")).toMatchObject({
  31. type: "delivery",
  32. });
  33. expect(edge("hook-turn-summary", "mobile-replayable")).toMatchObject({
  34. type: "delivery",
  35. });
  36. expect(edge("composer", "plan-shortcut")).toMatchObject({
  37. type: "shared",
  38. });
  39. });
  40. it("记录 MCP 诊断、官方 Server MCP 与浏览器 Tab 生命周期", () => {
  41. expect(node("mcp-settings-diagnostics").scope).toContain("pluginId");
  42. expect(node("official-server-mcp").scope).toMatch(/auth|quota/);
  43. expect(node("browser-tab-residency").scope).toContain("32-tab");
  44. expect(edge("mcp-settings-diagnostics", "mcp-runtime")).toMatchObject({
  45. type: "state",
  46. });
  47. expect(edge("official-server-mcp", "plan-identity")).toMatchObject({
  48. type: "state",
  49. });
  50. expect(edge("browser-tab-residency", "embedded-browser-host")).toMatchObject({
  51. type: "delivery",
  52. });
  53. });
  54. it("把 Document Skills 的格式范围与模型有效模态写清楚", () => {
  55. expect(node("document-skills").scope).toContain("PPTX/XLSX");
  56. expect(node("model-modalities").scope).toContain("video");
  57. expect(node("model-modalities").scope).toContain("provider wire");
  58. expect(node("model-selector").scope).toMatch(/模态|vision|reasoning/i);
  59. });
  60. });