// CustomLink.test.tsx import React from 'react' import { render, screen } from '@testing-library/react' import '@testing-library/jest-dom' import { CustomLink } from './index' // Mock de next/link para test jest.mock('next/link', () => { return ({ children, href }: any) => {children} }) describe('CustomLink component', () => { it('should render with default href when none is provided', () => { render(Home) const link = screen.getByRole('link', { name: 'Home' }) expect(link).toBeInTheDocument() expect(link).toHaveAttribute('href', '/') }) it('should render with provided href', () => { render(About) const link = screen.getByRole('link', { name: 'About' }) expect(link).toBeInTheDocument() expect(link).toHaveAttribute('href', '/about') }) it('should render children correctly', () => { render(Contact) const link = screen.getByRole('link') expect(link).toContainHTML('Contact') }) })