import React from 'react' import { renderWithProviders, screen } from '@/__tests__/utils/test-helpers' import Hero from './hero' jest.mock('@/components/ui/button', () => ({ Button: ({ children, ...props }: any) => , })) jest.mock('next/link', () => ({ __esModule: true, default: ({ children, href }: any) => {children}, })) describe('Hero Component', () => { it('should render with default title', () => { renderWithProviders() expect(screen.getByText('Host Your Portfolio')).toBeInTheDocument() }) it('should render with custom title', () => { const customTitle = 'Share Your Work with the World' renderWithProviders() expect(screen.getByText(customTitle)).toBeInTheDocument() }) it('should render with default description', () => { renderWithProviders() expect(screen.getByText(/Deploy and manage your portfolio websites/i)).toBeInTheDocument() }) it('should render with custom description', () => { const customDesc = 'Custom description for hero section' renderWithProviders() expect(screen.getByText(customDesc)).toBeInTheDocument() }) it('should display primary CTA button with link', () => { renderWithProviders() const getStartedLink = screen.getByRole('link', { name: /get started/i }) expect(getStartedLink).toHaveAttribute('href', '/register') }) it('should display secondary CTA button with link', () => { renderWithProviders() const viewExampleLink = screen.getByRole('link', { name: /view example/i }) expect(viewExampleLink).toBeInTheDocument() }) it('should use custom CTA text and href', () => { const customPrimaryCTA = { text: 'Create Portfolio', href: '/create', } renderWithProviders( ) expect(screen.getByRole('link', { name: /create portfolio/i })).toHaveAttribute('href', '/create') }) it('should hide secondary CTA if text is empty', () => { renderWithProviders( ) expect(screen.queryByText('View Example')).not.toBeInTheDocument() }) it('should have CTA buttons with correct size', () => { renderWithProviders() const buttons = screen.getAllByRole('button') expect(buttons.length).toBeGreaterThanOrEqual(2) }) it('should display responsive layout container', () => { const { container } = renderWithProviders() const section = container.querySelector('section') expect(section).toBeInTheDocument() expect(section).toHaveClass('bg-gradient-to-br') }) it('should have decorative trusted-by message', () => { renderWithProviders() expect(screen.getByText(/trusted by/i)).toBeInTheDocument() }) it('should render multiple CTA buttons in flex layout', () => { renderWithProviders() const links = screen.getAllByRole('link') // Should have at least 2 CTA links const ctaLinks = links.filter((link) => { const href = link.getAttribute('href') return href === '/register' || href === '#' }) expect(ctaLinks.length).toBeGreaterThanOrEqual(2) }) it('should be responsive with proper padding', () => { const { container } = renderWithProviders() const section = container.querySelector('section') expect(section).toHaveClass('py-20', 'md:py-32') }) it('should have proper heading hierarchy', () => { const { container } = renderWithProviders() const h1 = container.querySelector('h1') expect(h1).toBeInTheDocument() }) })