Track HiveGrid Cloud planning reference

This commit is contained in:
david committed 2026-06-26 20:48:01 +02:00
1 parent b3d5ea6764
commit e341c5938a
5784 files changed
+1104929 -3

No files matched your search

@@ -0,0 +1,37 @@
import "@testing-library/jest-dom";
import { fireEvent, render, screen } from "@testing-library/react";
import type { ComponentProps } from "react";
import { describe, expect, it, vi } from "vitest";
import CookiesList from "./CookiesList";
vi.mock("react-router", () => ({
Link: ({ children, to, ...props }: ComponentProps<"a"> & { to: string }) => (
<a href={to} {...props}>
{children}
</a>
),
}));
vi.mock("react-i18next", () => ({
useTranslation: () => ({
t: (key: string, options?: { count?: number }) => (key === "cookies.count" ? `${options?.count} localized cookies` : key),
}),
}));
describe("CookiesList", () => {
it("renders cookie category counts through i18n", () => {
render(<CookiesList editing />);
expect(screen.getAllByText(/\(\d+ localized cookies\)/).length).toBeGreaterThan(0);
expect(screen.queryByText(/\(\d+ cookies\)/)).not.toBeInTheDocument();
});
it("renders cookie expiry values through i18n", () => {
render(<CookiesList editing />);
fireEvent.click(screen.getByRole("button", { name: /cookies\.categories\.REQUIRED\.name/i }));
expect(screen.getByText("cookies.expiry.oneMonth")).toBeInTheDocument();
expect(screen.queryByText("1 month")).not.toBeInTheDocument();
});
});