feat(i18n): localize public landing
This commit is contained in:
@@ -4,6 +4,7 @@ import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import { MemoryRouter } from "react-router-dom";
|
||||
|
||||
import { api } from "./api";
|
||||
import { I18nProvider } from "./i18n/I18nProvider";
|
||||
import LandingPage from "./views/LandingPage";
|
||||
|
||||
const mockNavigate = jest.fn();
|
||||
@@ -12,17 +13,18 @@ jest.mock("react-router-dom", () => ({
|
||||
useNavigate: () => mockNavigate,
|
||||
}));
|
||||
|
||||
jest.mock("./api", () => ({ api: { get: jest.fn() } }));
|
||||
jest.mock("./api", () => ({ api: { get: jest.fn(), put: jest.fn().mockResolvedValue({ data: {} }) } }));
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
window.localStorage.clear();
|
||||
(api.get as jest.Mock).mockRejectedValue({ response: { status: 401 } });
|
||||
});
|
||||
|
||||
test("shows exactly Free and Pro without invented commercial terms", async () => {
|
||||
render(
|
||||
<MemoryRouter>
|
||||
<LandingPage />
|
||||
<I18nProvider><LandingPage /></I18nProvider>
|
||||
</MemoryRouter>,
|
||||
);
|
||||
|
||||
@@ -37,3 +39,11 @@ test("shows exactly Free and Pro without invented commercial terms", async () =>
|
||||
fireEvent.click(screen.getByRole("button", { name: "Sign in to view Pro" }));
|
||||
expect(mockNavigate).toHaveBeenCalledWith("/login", { state: { from: "/settings" } });
|
||||
});
|
||||
|
||||
test("switches the public landing page to Norwegian Bokmål", async () => {
|
||||
render(<MemoryRouter><I18nProvider><LandingPage /></I18nProvider></MemoryRouter>);
|
||||
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Norsk" }));
|
||||
expect(await screen.findByRole("heading", { name: "To tydelige alternativer" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Opprett en Free-konto" })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user