{"size": 1198, "ext": "js", "max_stars_repo_path": "src/Ledger/LedgerDetails/LedgerRolloverProgress/LedgerRolloverProgress.test.js", "max_stars_repo_name": "folio-org/ui-finance", "max_stars_repo_stars_event_min_datetime": "2018-02-06T19:39:36.000Z", "max_stars_repo_stars_event_max_datetime": "2018-02-06T19:39:36.000Z", "max_issues_repo_path": "src/Ledger/LedgerDetails/LedgerRolloverProgress/LedgerRolloverProgress.test.js", "max_issues_repo_name": "folio-org/ui-finance", "max_issues_repo_issues_event_min_datetime": "2018-07-05T19:57:10.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T16:04:09.000Z", "max_forks_repo_path": "src/Ledger/LedgerDetails/LedgerRolloverProgress/LedgerRolloverProgress.test.js", "max_forks_repo_name": "folio-org/ui-finance", "max_forks_repo_forks_event_min_datetime": "2018-03-16T13:34:19.000Z", "max_forks_repo_forks_event_max_datetime": "2020-01-28T10:51:40.000Z"}
{"max_stars_count": 1, "max_issues_count": 428, "max_forks_count": 6, "avg_line_length": 27.8604651163, "max_line_length": 91, "alphanum_fraction": 0.6736227045}
import React from 'react';
import { render, screen } from '@testing-library/react';
import { IntlProvider } from 'react-intl';
import { MemoryRouter } from 'react-router-dom';

import { OVERALL_ROLLOVER_STATUS } from '../../../common/const';
import LedgerRolloverProgress from './LedgerRolloverProgress';

const LEDGER_NAME = 'test ledger';

const renderComponent = ({
  ledgerName,
  fromYearCode,
  rolloverStatus,
  onClose = () => { },
}) => (render(
  <IntlProvider locale="en">
    <MemoryRouter>
      <LedgerRolloverProgress
        fromYearCode={fromYearCode}
        ledgerName={ledgerName}
        onClose={onClose}
        rolloverStatus={rolloverStatus}
      />
    </MemoryRouter>
  </IntlProvider>,
));

describe('LedgerRolloverProgress', () => {
  it('should display ledger name', () => {
    renderComponent({ ledgerName: LEDGER_NAME });
    expect(screen.getByText(LEDGER_NAME)).toBeDefined();
  });

  it('should display progress bar', () => {
    const { container } = renderComponent({
      rolloverStatus: { budgetsClosingRolloverStatus: OVERALL_ROLLOVER_STATUS.inProgress },
    });

    expect(container.querySelector('[data-test-progress-bar]')).toBeDefined();
  });
});
