import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { LeadStatusBadge } from '../lead-status-badge';

describe('LeadStatusBadge', () => {
  it('renders NEW status with correct label', () => {
    render(<LeadStatusBadge status="NEW" />);
    expect(screen.getByText('Mới')).toBeInTheDocument();
  });

  it('renders CONTACTED status with correct label', () => {
    render(<LeadStatusBadge status="CONTACTED" />);
    expect(screen.getByText('Đã liên hệ')).toBeInTheDocument();
  });

  it('renders QUALIFIED status with correct label', () => {
    render(<LeadStatusBadge status="QUALIFIED" />);
    expect(screen.getByText('Đủ điều kiện')).toBeInTheDocument();
  });

  it('renders NEGOTIATING status with correct label', () => {
    render(<LeadStatusBadge status="NEGOTIATING" />);
    expect(screen.getByText('Đang thương lượng')).toBeInTheDocument();
  });

  it('renders CONVERTED status with correct label', () => {
    render(<LeadStatusBadge status="CONVERTED" />);
    expect(screen.getByText('Chuyển đổi')).toBeInTheDocument();
  });

  it('renders LOST status with correct label', () => {
    render(<LeadStatusBadge status="LOST" />);
    expect(screen.getByText('Mất')).toBeInTheDocument();
  });

  it('falls back to raw status value for unknown status', () => {
    // @ts-expect-error testing unknown status
    render(<LeadStatusBadge status="UNKNOWN" />);
    expect(screen.getByText('UNKNOWN')).toBeInTheDocument();
  });
});
