import { render } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
import { WebVitals } from '../web-vitals';

// Mock web-vitals
vi.mock('web-vitals', () => ({
  onLCP: vi.fn(),
  onFCP: vi.fn(),
  onCLS: vi.fn(),
  onTTFB: vi.fn(),
  onINP: vi.fn(),
}));

// Mock the internal web-vitals lib
vi.mock('@/lib/web-vitals', () => ({
  reportWebVital: vi.fn(),
  flushWebVitals: vi.fn(),
}));

describe('WebVitals', () => {
  it('renders nothing (returns null)', () => {
    const { container } = render(<WebVitals />);
    expect(container.firstChild).toBeNull();
  });

  it('does not throw when rendered', () => {
    expect(() => render(<WebVitals />)).not.toThrow();
  });
});
