/* @vitest-environment jsdom */

import { render, screen } from '@testing-library/react';
import { expect, test } from 'vitest';

import { AffinityStatusCard } from './AffinityStatusCard';

test('renders affinity level with dark platform pill badge tone', () => {
  render(<AffinityStatusCard affinity={72} />);

  const levelBadge = screen.getAllByText('信任')[0]!;

  expect(levelBadge.className).toContain('rounded-full');
  expect(levelBadge.className).toContain('bg-amber-500/10');
  expect(levelBadge.className).toContain('text-amber-100');
});

test('renders affinity summary and progress with dark PlatformSubpanel chrome', () => {
  render(<AffinityStatusCard affinity={28} />);

  const levelPanel = screen.getByText('好感等级').closest('section');
  const progressPanel = screen.getByText('好感进度').closest('section');

  expect(levelPanel?.className).toContain('border-white/10');
  expect(levelPanel?.className).toContain('bg-black/25');
  expect(levelPanel?.className).toContain('rounded-xl');
  expect(progressPanel?.className).toContain('border-white/10');
  expect(progressPanel?.className).toContain('bg-black/25');
  expect(progressPanel?.className).toContain('sm:p-4');
});
