| import { afterEach, describe, expect, it, vi } from "vitest"; |
|
|
| import { createCommandMenuItems } from "#/components/features/command-menu/command-menu-items"; |
|
|
| |
| |
| |
| |
| |
| vi.mock("#/manifests/manifest-sources", async (importOriginal) => { |
| const actual = |
| await importOriginal<typeof import("#/manifests/manifest-sources")>(); |
| return { ...actual, AUTOMATION_INTERFACE_CANDIDATE: undefined }; |
| }); |
|
|
| describe("the command menu without an admitted interface manifest", () => { |
| it("omits the automations entry and keeps the rest", () => { |
| |
| const items = createCommandMenuItems({ toggleSidebar: vi.fn() }); |
|
|
| |
| expect(items.some((item) => item.id === "automations")).toBe(false); |
| expect(items.some((item) => item.id === "new-chat")).toBe(true); |
| }); |
| }); |
|
|
| const settingsItemIds = (items: ReturnType<typeof createCommandMenuItems>) => |
| items.filter((item) => item.group === "settings").map((item) => item.id); |
|
|
| |
| |
| |
| |
| |
| describe("the command menu settings group", () => { |
| afterEach(() => { |
| vi.unstubAllEnvs(); |
| }); |
|
|
| it("lists every settings page when not locked to a Cloud host", () => { |
| |
| const items = createCommandMenuItems({ toggleSidebar: vi.fn() }); |
|
|
| |
| expect(settingsItemIds(items)).toEqual([ |
| "settings", |
| "agent-settings", |
| "llm-settings", |
| "condenser-settings", |
| "verification-settings", |
| "app-settings", |
| "secrets-settings", |
| ]); |
| }); |
|
|
| it("keeps only Settings and Application when locked to a Cloud host", () => { |
| |
| vi.stubEnv("VITE_LOCK_TO_CLOUD", "https://app.all-hands.dev"); |
|
|
| |
| const items = createCommandMenuItems({ toggleSidebar: vi.fn() }); |
|
|
| |
| expect(settingsItemIds(items)).toEqual(["settings", "app-settings"]); |
| expect(items.map((item) => item.id)).toEqual([ |
| "new-chat", |
| "customize", |
| "mcp", |
| "settings", |
| "app-settings", |
| "toggle-sidebar", |
| ]); |
| }); |
| }); |
|
|