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

describe('[Native] AtomCheckbox', () => {
  it('rendered component', () => {
    const mockHandler = jest.fn();
    const body = {
      onChange: () => mockHandler,
    }
    const component = render(<AtomCheckbox {...body} />);
    expect(component).toBeTruthy();
  });
  it('clicking checkbox', () => {
    const mockHandler = jest.fn();
    const body = {
      onChange: () => mockHandler,
    }
    const component = render(<AtomCheckbox {...body} />);
    const checkbox = component.getByTestId('checkbox');
    fireEvent.press(checkbox);
  });
  it('clicking checkbox disabled', () => {
    const mockHandler = jest.fn();
    const body = {
      onChange: () => mockHandler,
      checked: true,
      disabled: true,
    }
    const component = render(<AtomCheckbox {...body} />);
    const checkbox = component.getByTestId('checkbox');
    fireEvent.press(checkbox);
  });
});
