capabilityMapOfficeComputerUse.test.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import { describe, expect, it } from "vitest";
  2. import { capabilityEdges, capabilityGroups, capabilityNodes } from "@/data/productCapabilityMap.js";
  3. describe("办公套件与 Computer Use 孵化能力", () => {
  4. it("在 Renderer 中保留独立能力群,并只统计当前代码量", () => {
  5. const group = capabilityGroups.find(
  6. (candidate) => candidate.id === "office-computer-use-incubation",
  7. );
  8. const nodes = capabilityNodes.filter((node) => node.groupId === group?.id);
  9. expect(group).toMatchObject({
  10. systemId: "renderer",
  11. codeEstimate: {
  12. productionLines: 1_200,
  13. },
  14. });
  15. expect(nodes.map((node) => node.id)).toEqual([
  16. "office-document-preview",
  17. "office-spreadsheet-workbench",
  18. "office-presentation-workbench",
  19. "office-native-editing",
  20. "computer-use-task-ux",
  21. "computer-use-takeover",
  22. ]);
  23. expect(nodes.some((node) => node.scope.includes("当前:"))).toBe(true);
  24. expect(nodes.some((node) => node.scope.includes("规划:"))).toBe(true);
  25. });
  26. it("把 Renderer 体验连接到 Host 和 CLI 的当前支撑能力", () => {
  27. expect(capabilityNodes).toEqual(
  28. expect.arrayContaining([
  29. expect.objectContaining({
  30. id: "office-document-service",
  31. groupId: "workbench-services",
  32. }),
  33. expect.objectContaining({
  34. id: "document-skills",
  35. groupId: "extension-runtime",
  36. }),
  37. expect.objectContaining({
  38. id: "computer-use-mcp",
  39. groupId: "extension-runtime",
  40. }),
  41. expect.objectContaining({
  42. id: "cua-helper-lifecycle",
  43. groupId: "browser-platform",
  44. }),
  45. ]),
  46. );
  47. expect(capabilityEdges).toEqual(
  48. expect.arrayContaining([
  49. expect.objectContaining({
  50. source: "document-skills",
  51. target: "office-native-editing",
  52. }),
  53. expect.objectContaining({
  54. source: "computer-use-mcp",
  55. target: "computer-input-execution",
  56. }),
  57. expect.objectContaining({
  58. source: "mobile-remote",
  59. target: "cua-helper-lifecycle",
  60. type: "invariant",
  61. }),
  62. ]),
  63. );
  64. });
  65. it("把 Windows 按工具触发的顶部提示记录为当前本地 Host 投影能力", () => {
  66. expect(capabilityNodes.find((node) => node.id === "computer-use-task-ux")).toMatchObject({
  67. scope: expect.stringContaining("Windows 顶部操作提示"),
  68. authority: "Desktop Main native projection + Renderer tool projection",
  69. });
  70. expect(capabilityNodes.find((node) => node.id === "computer-use-task-ux")?.scope).toContain(
  71. "computer-use/operation-event",
  72. );
  73. expect(capabilityEdges).toEqual(
  74. expect.arrayContaining([
  75. expect.objectContaining({
  76. source: "local-host",
  77. target: "computer-use-task-ux",
  78. type: "state",
  79. label: expect.stringContaining("computer-use/operation-event"),
  80. }),
  81. ]),
  82. );
  83. expect(
  84. capabilityEdges.find(
  85. (edge) => edge.source === "local-host" && edge.target === "computer-use-task-ux",
  86. )?.label,
  87. ).toContain("computer-use/operation-event");
  88. });
  89. });