import React from 'react';
import {render, screen} from '@testing-library/react';
import CommunitySection from '../CommunitySection';

jest.mock('next/link', () => {
  return ({children, href, ...props}: {children: React.ReactNode; href: string; [key: string]: unknown}) => (
    <a href={href} {...props}>{children}</a>
  );
});

describe('CommunitySection', () => {
  it('renders title and CTA buttons', () => {
    render(<CommunitySection locale="fr" />);
    expect(screen.getByText('community_title')).toBeInTheDocument();
    expect(screen.getByText('community_subtitle')).toBeInTheDocument();
    expect(screen.getByText('community_cta_join')).toBeInTheDocument();
    expect(screen.getByText('community_cta_donate')).toBeInTheDocument();
  });

  it('renders app store badges with two-line text', () => {
    render(<CommunitySection locale="fr" />);
    expect(screen.getByText('community_app_store')).toBeInTheDocument();
    expect(screen.getByText('community_google_play')).toBeInTheDocument();
    const labels = screen.getAllByText('community_available_on');
    expect(labels.length).toBe(2);
  });
});
