import { describe, it, expect, vi } from 'vitest';
import { screen, waitFor } from '@testing-library/react';
import { renderWithProviders } from '../../test/utils/renderWithProviders';

// Mock useThemeMode
vi.mock('../../hooks/useThemeMode', () => ({
  useThemeMode: () => false,
}));

// Mock CalendarView since it uses complex dayjs/calendar logic
vi.mock('./components/CalendarView', () => ({
  CalendarView: () => <div data-testid="calendar-view">日历视图</div>,
}));

import DoctorSchedule from './DoctorSchedule';

describe('DoctorSchedule', () => {
  it('renders the schedule page with doctor select', async () => {
    vi.setConfig({ testTimeout: 15000 });
    renderWithProviders(<DoctorSchedule />);

    await waitFor(() => {
      expect(screen.getByText('选择医护:')).toBeInTheDocument();
    });
  });

  it('shows empty state when no doctor selected', async () => {
    renderWithProviders(<DoctorSchedule />);

    await waitFor(() => {
      expect(screen.getByText('请先选择医护以查看排班')).toBeInTheDocument();
    });
  });

  it('has a card container', async () => {
    renderWithProviders(<DoctorSchedule />);

    await waitFor(() => {
      const card = document.querySelector('.ant-card');
      expect(card).toBeInTheDocument();
    });
  });
});
