import { render } from '@testing-library/react';
import { DateTime, Settings } from 'luxon';
import React from 'react';
import { describe, expect, it } from 'vitest';
import { DatePicker } from './DatePicker';

describe('DatePicker', () => {
  Settings.defaultLocale = navigator.language;

  it('renders the component without crashing', () => {
    const { container } = render(<DatePicker value={DateTime.local()} />);

    expect(container).toBeTruthy();
  });

  it('accepts the value from prop', () => {
    const now = DateTime.local();
    const { container } = render(<DatePicker value={now} />);

    // Calendar component from react-calendar should render
    const calendar = container.querySelector('.react-calendar');
    expect(calendar).toBeInTheDocument();
  });
});
