settingsSubagentRowContent.test.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { readSourceTextAsync } from "./readSourceText.js";
  2. import { describe, expect, it } from "vitest";
  3. describe("settings subagent row content", () => {
  4. it("does not repeat the scope already expressed by group headings", async () => {
  5. const source = await readSourceTextAsync(
  6. new URL("../src/settings/SubagentsSection.tsx", import.meta.url),
  7. );
  8. expect(source).not.toContain("getScopeMessageId");
  9. expect(source).toContain("showModelBadge ? <AgentBadge>{modelLabel}</AgentBadge>");
  10. expect(source).toContain("<AgentBadge>{toolsLabel}</AgentBadge>");
  11. expect(source).toContain(
  12. '"inline-flex min-h-5 items-center rounded-md bg-surface px-1.5 py-0.5 text-ui-sm text-foreground-subtle ring-1 ring-border"',
  13. );
  14. expect(source).not.toContain("rounded-md bg-secondary");
  15. });
  16. it("does not expose backing paths or built-in identifiers in list rows", async () => {
  17. const source = await readSourceTextAsync(
  18. new URL("../src/settings/SubagentsSection.tsx", import.meta.url),
  19. );
  20. expect(source).not.toContain("{agent.path}");
  21. });
  22. it("uses the shared scoped resource-list structure", async () => {
  23. const source = await readSourceTextAsync(
  24. new URL("../src/settings/SubagentsSection.tsx", import.meta.url),
  25. );
  26. expect(source).toContain("<PluginScopeMenu");
  27. expect(source).toContain('id: "settings.subagents.group.user"');
  28. // c0a58959fc 起插件 label 统一走 marketplace listing 解析(同名插件跨市场保持独立 label)。
  29. expect(source).toContain("resolvePluginDisplayName(");
  30. expect(source).toContain("<PluginSearchEmptyState");
  31. expect(source).not.toContain("statusFilter");
  32. expect(source).not.toContain("openUserAgentsFolder");
  33. });
  34. });