|
| 1 | +import { render, screen } from "@testing-library/react"; |
| 2 | +import { describe, expect, it, vi } from "vitest"; |
| 3 | + |
| 4 | +vi.mock("@posthog/ui/features/canvas/hooks/useChannels", () => ({ |
| 5 | + useChannels: () => ({ |
| 6 | + channels: [{ id: "personal-space", name: "me", path: "/me" }], |
| 7 | + isLoading: false, |
| 8 | + }), |
| 9 | +})); |
| 10 | +vi.mock("@posthog/ui/features/canvas/hooks/useChannelsLayout", () => ({ |
| 11 | + useChannelsLayout: () => true, |
| 12 | +})); |
| 13 | +vi.mock("@posthog/ui/features/canvas/components/ChannelHeader", () => ({ |
| 14 | + ChannelHeader: () => null, |
| 15 | +})); |
| 16 | +vi.mock("@posthog/ui/hooks/useSetHeaderContent", () => ({ |
| 17 | + useSetHeaderContent: () => {}, |
| 18 | +})); |
| 19 | +vi.mock("@posthog/ui/router/navigationBridge", () => ({ |
| 20 | + navigateToNewLoop: vi.fn(), |
| 21 | +})); |
| 22 | +vi.mock("@posthog/ui/features/canvas/hooks/useOrgMembers", () => ({ |
| 23 | + useOrgMembers: () => ({ |
| 24 | + members: [], |
| 25 | + isLoading: false, |
| 26 | + isError: false, |
| 27 | + isComplete: true, |
| 28 | + }), |
| 29 | +})); |
| 30 | +vi.mock("@posthog/ui/features/loops/hooks/useLoops", () => ({ |
| 31 | + useLoops: () => ({ data: [], isLoading: false, isError: false }), |
| 32 | + useLoopLimits: () => null, |
| 33 | +})); |
| 34 | +vi.mock("@posthog/ui/features/loops/components/LoopBuilderComposer", () => ({ |
| 35 | + LoopBuilderComposer: () => null, |
| 36 | +})); |
| 37 | +vi.mock("@posthog/ui/features/loops/components/LoopFallbacks", () => ({ |
| 38 | + LoopsEmptyNotice: () => null, |
| 39 | + LoopsSkeleton: () => null, |
| 40 | +})); |
| 41 | +vi.mock("@posthog/ui/features/loops/components/LoopRow", () => ({ |
| 42 | + LoopRow: () => null, |
| 43 | +})); |
| 44 | +vi.mock("@posthog/ui/features/loops/components/LoopsEmptyState", () => ({ |
| 45 | + LoopsEmptyState: () => null, |
| 46 | +})); |
| 47 | +vi.mock("@posthog/ui/features/loops/components/LoopTemplatesSection", () => ({ |
| 48 | + LoopTemplatesSection: () => null, |
| 49 | +})); |
| 50 | +vi.mock("@posthog/ui/features/canvas/hooks/useTaskChannels", () => ({ |
| 51 | + PERSONAL_CHANNEL_NAME: "me", |
| 52 | +})); |
| 53 | +vi.mock("@posthog/ui/features/loops/components/LoopsListView", () => ({ |
| 54 | + LoopsListView: () => <div>Project loops registry</div>, |
| 55 | +})); |
| 56 | + |
| 57 | +import { WebsiteChannelLoops } from "./WebsiteChannelLoops"; |
| 58 | + |
| 59 | +describe("WebsiteChannelLoops", () => { |
| 60 | + it("shows the project loops registry in the Personal space", () => { |
| 61 | + render(<WebsiteChannelLoops channelId="personal-space" />); |
| 62 | + |
| 63 | + expect(screen.getByText("Project loops registry")).toBeInTheDocument(); |
| 64 | + }); |
| 65 | +}); |
0 commit comments