test: Create unit tests for react components in packages/ui/components/credits (#10044)
Co-authored-by: gitstart-calcom <gitstart@users.noreply.github.com>pull/9265/head
parent
1aa3077706
commit
85c3c6dfc0
|
@ -0,0 +1,35 @@
|
||||||
|
/* eslint-disable playwright/missing-playwright-await */
|
||||||
|
import { render, screen } from "@testing-library/react";
|
||||||
|
import { vi } from "vitest";
|
||||||
|
|
||||||
|
import Credits from "./Credits";
|
||||||
|
|
||||||
|
vi.mock("../../../../apps/web/package.json", async () => {
|
||||||
|
return {
|
||||||
|
default: {
|
||||||
|
version: "mockedVersion",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Tests for Credits component", () => {
|
||||||
|
test("Should render credits section with links", () => {
|
||||||
|
render(<Credits />);
|
||||||
|
|
||||||
|
const creditsLinkElement = screen.getByRole("link", { name: /Cal\.com, Inc\./i });
|
||||||
|
expect(creditsLinkElement).toBeInTheDocument();
|
||||||
|
expect(creditsLinkElement).toHaveAttribute("href", "https://go.cal.com/credits");
|
||||||
|
|
||||||
|
const versionLinkElement = screen.getByRole("link", { name: /mockedVersion/i });
|
||||||
|
expect(versionLinkElement).toBeInTheDocument();
|
||||||
|
expect(versionLinkElement).toHaveAttribute("href", "https://go.cal.com/releases");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Should render credits section with correct text", () => {
|
||||||
|
render(<Credits />);
|
||||||
|
|
||||||
|
const currentYear = new Date().getFullYear();
|
||||||
|
const copyrightElement = screen.getByText(`© ${currentYear}`);
|
||||||
|
expect(copyrightElement).toHaveTextContent(`${currentYear}`);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue