/* eslint-disable no-lone-blocks */
/* eslint-disable no-unused-expressions */
import React from 'react';
import { render, cleanup } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';

import OperatorCtaButton from './operator-cta';

const data = (activeStatus = 'active') => ({
  operator: {
    status: activeStatus,
  },
  pageTemplate: 'default',
  buttonType: 'primary',
  buttonSize: 'm',
  tracker: 'main',
  translationsObj: {
    active: { translationKey: 'play_now', defaultValue: 'Visit' },
    not_recommended: { translationKey: 'not_recommended', defaultValue: 'Not Recommended' },
    coming_soon: { translationKey: 'coming_soon', defaultValue: 'Soon Available' },
    inactive: { translationKey: 'inactive', defaultValue: 'Not Accepting New Players' },
    blacklisted: { translationKey: 'blacklisted', defaultValue: 'Blacklisted' },
  },
});

describe('OperatorCtaButton Component', () => {
  test('OperatorCtaButton with status active', () => {
    const { getByText } = render(<OperatorCtaButton {...data()} />);
    expect(getByText('Visit')).toBeTruthy();
  });

  test('OperatorCtaButton with status inactive', () => {
    const { getByText } = render(<OperatorCtaButton {...data('inactive')} />);
    expect(getByText('Not Accepting New Players')).toBeTruthy();
  });

  test('OperatorCtaButton with status not_recommended', () => {
    const { getByText } = render(<OperatorCtaButton {...data('not_recommended')} />);
    expect(getByText('Not Recommended')).toBeTruthy();
  });

  test('OperatorCtaButton with status coming_soon', () => {
    const { getByText } = render(<OperatorCtaButton {...data('coming_soon')} />);
    expect(getByText('Soon Available')).toBeTruthy();
  });
});

afterEach(() => {
  cleanup();
});
