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

describe('PurchaseSubscriptionSidebar — settings menu', () => {
  it('lists secretary and staff management (moved out of the main nav)', () => {
    renderWithProviders(<PurchaseSubscriptionSidebar active="staff" />, { route: '/admin/staff' });

    const secretary = screen.getByRole('link', { name: 'مدیریت منشی' });
    const staff = screen.getByRole('link', { name: 'پرسنل' });

    expect(secretary).toHaveAttribute('href', '/admin/my-secretaries');
    expect(staff).toHaveAttribute('href', '/admin/staff');
  });

  it('highlights the active item (aria-current) for staff', () => {
    renderWithProviders(<PurchaseSubscriptionSidebar active="staff" />, { route: '/admin/staff' });
    expect(screen.getByRole('link', { name: 'پرسنل' })).toHaveAttribute('aria-current', 'page');
    expect(screen.getByRole('link', { name: 'مدیریت منشی' })).not.toHaveAttribute('aria-current');
  });
});
