import React from "react";
import { Footer } from "./index";
import { FooterProps } from "./types";
import { fireEvent, render, screen } from "@testing-library/react";
// Mock dependencies
jest.mock("@shared/components/divider", () => ({
Divider: ({ className }: { className?: string }) => (
),
}));
jest.mock("@shared/components/text", () => ({
Text: ({ as: Tag = "span", children, className }: any) => (
{children}
),
}));
jest.mock("../button", () => ({
Button: ({
onClick,
linkClassName,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
linkVariant,
buttonLabel,
...rest
}: any) => (
),
}));
const mockLinks = [
{
title: "Products",
items: {
items: [
{ buttonLabel: "Internet", href: "/internet" },
{ buttonLabel: "TV", href: "/tv" },
{ buttonLabel: "Phone", href: "/phone" },
],
},
},
{
title: "Support",
items: {
items: [
{ buttonLabel: "Help Center", href: "/help" },
{ buttonLabel: "Contact Us", href: "/contact" },
],
},
},
];
const mockBottomLinks = [
{ buttonLabel: "Privacy Policy", href: "/privacy" },
{ buttonLabel: "Terms of Use", href: "/terms" },
{ buttonLabel: "Accessibility", href: "/accessibility" },
];
const defaultProps: FooterProps = {
body: Promotional content and disclaimers go here.
,
links: mockLinks,
bottomLinks: mockBottomLinks,
copyrights: "All rights reserved.",
terms: "Kinetic by Windstream.",
maxWidth: true,
};
describe("Footer", () => {
describe("Rendering", () => {
it("renders with all props", () => {
render();
expect(
screen.getByText("Promotional content and disclaimers go here.")
).toBeInTheDocument();
expect(screen.getByText("Products")).toBeInTheDocument();
expect(screen.getByText("Support")).toBeInTheDocument();
expect(screen.getByText("All rights reserved.")).toBeInTheDocument();
});
it("renders with minimal props (body only)", () => {
render(