import { render, screen } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
import { NotificationsProvider } from '../notifications-provider';

const useSocketNotificationsMock = vi.fn();

vi.mock('@/lib/hooks/use-socket-notifications', () => ({
  useSocketNotifications: () => useSocketNotificationsMock(),
}));

describe('NotificationsProvider', () => {
  it('renders children', () => {
    render(
      <NotificationsProvider>
        <div>child</div>
      </NotificationsProvider>,
    );
    expect(screen.getByText('child')).toBeInTheDocument();
  });

  it('initializes socket notifications hook on mount', () => {
    useSocketNotificationsMock.mockClear();
    render(
      <NotificationsProvider>
        <span>x</span>
      </NotificationsProvider>,
    );
    expect(useSocketNotificationsMock).toHaveBeenCalled();
  });
});
