feat(plans): publish honest Free and Pro
CI and Deploy / test (pull_request) Successful in 5m6s
CI and Deploy / deploy (pull_request) Has been skipped

This commit is contained in:
cesnimda
2026-08-15 18:04:18 +02:00
parent a7c25499bb
commit a25c31b93a
26 changed files with 403 additions and 93 deletions
+39
View File
@@ -0,0 +1,39 @@
import React from "react";
import "@testing-library/jest-dom";
import { fireEvent, render, screen } from "@testing-library/react";
import { MemoryRouter } from "react-router-dom";
import { api } from "./api";
import LandingPage from "./views/LandingPage";
const mockNavigate = jest.fn();
jest.mock("react-router-dom", () => ({
...jest.requireActual("react-router-dom"),
useNavigate: () => mockNavigate,
}));
jest.mock("./api", () => ({ api: { get: jest.fn() } }));
beforeEach(() => {
jest.clearAllMocks();
(api.get as jest.Mock).mockRejectedValue({ response: { status: 401 } });
});
test("shows exactly Free and Pro without invented commercial terms", async () => {
render(
<MemoryRouter future={{ v7_startTransition: true, v7_relativeSplatPath: true }}>
<LandingPage />
</MemoryRouter>,
);
expect(await screen.findByRole("heading", { name: "Two clear plans" })).toBeInTheDocument();
expect(screen.getAllByRole("heading", { level: 3 }).map((heading) => heading.textContent)).toEqual(["Free", "Pro"]);
expect(screen.queryByText(/bring your own key|unlimited AI|billed monthly|trial|£9|£3/i)).not.toBeInTheDocument();
expect(screen.getByText(/Commercial terms appear only in configured checkout/i)).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Create a Free account" }));
expect(mockNavigate).toHaveBeenCalledWith("/register");
fireEvent.click(screen.getByRole("button", { name: "Sign in to view Pro" }));
expect(mockNavigate).toHaveBeenCalledWith("/login", { state: { from: "/settings" } });
});