import React from "react"; import { Button } from "./index"; import { beforeEach, describe, expect, it, jest } from "@jest/globals"; import "@testing-library/jest-dom/jest-globals"; import { fireEvent, render, screen } from "@testing-library/react"; jest.mock("@shared/components/brand-button", () => ({ BrandButton: ({ as, href, text, label, iconName, iconSize, iconFill, onClick, id, variant, fullWidth, size, buttonClassName, // eslint-disable-next-line @typescript-eslint/no-unused-vars ...rest }: any) => { const Tag = as || "button"; return ( {label} {text} ); }, })); jest.mock("@shared/components/button", () => ({ // eslint-disable-next-line @typescript-eslint/no-unused-vars Button: ({ onClick, className, children, ...rest }: any) => ( ), })); jest.mock("@shared/components/link", () => ({ Link: ({ children, href, target, // eslint-disable-next-line @typescript-eslint/no-unused-vars variant, className, title, onClick, }: any) => ( {children} ), })); jest.mock("@shared/components/material-icon", () => ({ MaterialIcon: ({ name, size, fill }: any) => ( ), })); jest.mock("@shared/utils/utm", () => ({ buildPreservedQueryHref: (href: string, search: string) => `${href}${search}`, })); describe("Button", () => { beforeEach(() => { jest.clearAllMocks(); }); describe("showButtonAs='solid' (default)", () => { it("renders BrandButton as anchor when href is provided", () => { render(