import React from "react";
import { render } from "@testing-library/react-native";
import '@testing-library/jest-dom';
import { OrganismsTierLevel } from './index';

describe('[Native] TierLevel', () => {
  it('rendered component', () => {
    const mockHandler = jest.fn();
    const body = {
      type: 'mobile',
      actualPoints: 1360,
      nextPoints: 5000,
      actualTier: 'Silver Tier',
      nextTier: 'pts to Gold',
      handleClick: mockHandler,
      iconName: 'tier_silver',
      colorProgress: 'neutral600',
    } as const;
    const component = render(<OrganismsTierLevel {...body} />);
    expect(component).toBeTruthy();
  });
  it('rendered component with 0 nextPoints', () => {
    const mockHandler = jest.fn();
    const body = {
      type: 'desktop',
      actualPoints: 5000,
      nextPoints: 0,
      actualTier: 'Gold Tier',
      nextTier: '',
      handleClick: mockHandler,
      iconName: 'tier_gold'
    } as const;
    const component = render(<OrganismsTierLevel {...body} />);
    expect(component).toBeTruthy();
  });
  it('evaluate if points is negative number', () => {
    const body = {
      type: 'desktop',
      actualPoints: -400,
      nextPoints: -500,
      actualTier: 'Silver Tier',
      nextTier: 'pts to gold',
      iconName: 'tier_silver'
    } as const;
    const component = render(<OrganismsTierLevel {...body} />);
    component.getByText('0');
  });

  it('evaluate if there is not next tier', () => {
    const body = {
      type: 'desktop',
      actualPoints: 400,
      nextPoints: 500,
      actualTier: 'Silver Tier',
      nextTier: '',
      iconName: 'tier_silver'
    } as const;
    const component = render(<OrganismsTierLevel {...body} />);
    component.getByText('400');
  });
});
