Skip to main content
Glama

Convex MCP server

Official
by get-convex
FreePlan.test.tsx3.3 kB
import { render, screen, fireEvent, act, getByText, getByRole, } from "@testing-library/react"; import { OrbSubscriptionResponse, Team } from "generatedApi"; import { FreePlan } from "./FreePlan"; const cancelSubscription = jest.fn(); jest.mock("api/billing", () => ({ useCancelSubscription: () => cancelSubscription, })); const setSupportFormOpen = jest.fn(); jest.mock("../../../elements/SupportWidget", () => ({ useSupportFormOpen: () => [false, setSupportFormOpen], })); const subscription: OrbSubscriptionResponse = { plan: { id: "", name: "", description: "", status: "active", seatPrice: 0, planType: "", }, billingContact: { name: "", email: "", }, status: "active", nextBillingPeriodStart: "2025-09-25", }; const team: Team = { id: 0, name: "", creator: 0, slug: "", suspended: false, referralCode: "CODE123", }; describe("FreePlan", () => { beforeEach(() => { jest.resetAllMocks(); }); test("Downgrade plan button should not be visible if there is no subscription", () => { render( <FreePlan subscription={undefined} hasAdminPermissions team={team} />, ); const downgradeButton = screen.queryByText("Downgrade to Free"); expect(downgradeButton).not.toBeInTheDocument(); screen.getByText("Current Plan"); }); test("Should be able to downgrade plan", async () => { const hasAdminPermissions = true; render( <FreePlan subscription={subscription} hasAdminPermissions={hasAdminPermissions} team={team} />, ); const downgradeButton = screen.getByText("Downgrade to Free"); await act(() => { fireEvent.click(downgradeButton); }); const confirmationDialog = screen.getByRole("dialog"); expect(confirmationDialog).toBeInTheDocument(); const confirmButton = getByText(confirmationDialog, "Downgrade"); expect(confirmButton).toBeDisabled(); const checkbox = getByRole(confirmationDialog, "checkbox"); await act(() => { checkbox.click(); }); expect(confirmButton).toBeEnabled(); expect(cancelSubscription).toHaveBeenCalledTimes(0); await act(() => { confirmButton.click(); }); expect(cancelSubscription).toHaveBeenCalledTimes(1); }); test("Should say Current Plan if the plan is already Free", () => { render(<FreePlan hasAdminPermissions team={team} />); screen.getByText("Current Plan"); }); test("Should not be able to downgrade plan as non-admin", () => { const hasAdminPermissions = false; render( <FreePlan subscription={subscription} hasAdminPermissions={hasAdminPermissions} team={team} />, ); const downgradeButton = screen.getByText("Downgrade to Free"); expect(downgradeButton).toBeDisabled(); }); test("Should not be able to downgrade plan as admin with end date", () => { const hasAdminPermissions = true; render( <FreePlan subscription={{ ...subscription, endDate: 0 }} hasAdminPermissions={hasAdminPermissions} team={team} />, ); const downgradeButton = screen.queryByText("Downgrade to Free"); expect(downgradeButton).toBeNull(); screen.getByText("Next Billing Cycle"); }); });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/get-convex/convex-backend'

If you have feedback or need assistance with the MCP directory API, please join our Discord server