import React from 'react';
import { render, fireEvent, } from "@testing-library/react-native";
import { AtomInputDate } from './index';

describe('[Native] AtomInputDate', () => {
  it('redered component', () => {
    const body = {
      date: new Date().toString(),
    };
    const component = render(<AtomInputDate {...body} />);
    expect(component).toBeTruthy();
  });
  it('redered component disabled', () => {
    const body = {
      date: new Date().toString(),
      disabled: true,
      width: '200px'
    };
    const component = render(<AtomInputDate {...body} />);
    expect(component).toBeTruthy();
  });
  it('set date', async () => {
    const body = {
      date: '02-04-2015'
    };
    const component = render(<AtomInputDate date= '02-04-2015' />);

    const selectMonth = component.getByTestId('testMonth');
    fireEvent.press(selectMonth);
    const optionMonth = component.getByTestId('testMonth-02');
    fireEvent.press(optionMonth);
    const selectDay = component.getByTestId('testDay');
    fireEvent.press(selectDay);
    const optionDay = component.getByTestId('testDay-02');
    fireEvent.press(optionDay);
    const selectYear = component.getByTestId('testYear');
    fireEvent.press(selectYear);
    const optionYear = component.getByTestId('testYear-2014');
    fireEvent.press(optionYear);
  })
});
