Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 4s
Build & Deploy / 🏗️ Build (push) Successful in 1m41s
Build & Deploy / 🧪 QA (push) Successful in 2m1s
Build & Deploy / 🚀 Deploy (push) Failing after 7s
Build & Deploy / 🩺 Health Check (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { describe, it, expect } from "vitest";
|
|
import Home from "../components/HomeContent";
|
|
import { NextIntlClientProvider } from "next-intl";
|
|
import messages from "../messages/de.json";
|
|
|
|
const renderHome = () => {
|
|
return render(
|
|
<NextIntlClientProvider locale="de" messages={messages}>
|
|
<Home />
|
|
</NextIntlClientProvider>,
|
|
);
|
|
};
|
|
|
|
describe("Home Page", () => {
|
|
it("renders the hero section with correct title", () => {
|
|
renderHome();
|
|
expect(
|
|
screen.getByRole("heading", { name: /Spezialisierter Partner/i }),
|
|
).toBeInTheDocument();
|
|
});
|
|
|
|
it("contains the CTA button", () => {
|
|
renderHome();
|
|
const ctaButton = screen.getByRole("link", { name: /Projekt anfragen/i });
|
|
expect(ctaButton).toBeInTheDocument();
|
|
expect(ctaButton).toHaveAttribute("href", "/kontakt");
|
|
});
|
|
|
|
it("renders the portfolio section", async () => {
|
|
renderHome();
|
|
expect(await screen.findByText(/Unsere Leistungen/i)).toBeInTheDocument();
|
|
// Use getAllByText because it appears in both hero description and card title
|
|
const elements = await screen.findAllByText(/Technische Beratung/i);
|
|
expect(elements.length).toBeGreaterThan(0);
|
|
});
|
|
});
|