<commit_before>/* eslint-env jest */
import React from 'react';
import { shallow } from 'enzyme';

import ProgressBar from './../ProgressBar';

const REQUIRED_PROPS = {
  delay: 5000,
  isRunning: true,
  closeToast: jest.fn()
};

describe('ProgressBar', () => {
  it('Should merge className', () => {
    const component = shallow(
      <ProgressBar
        {...REQUIRED_PROPS}
        className="test"
      />
    );
    expect(component.find('.test')).toHaveLength(1);
  });

  it('Should call closeToast function when animation end', () => {
    const component = shallow(<ProgressBar {...REQUIRED_PROPS} />);

    expect(REQUIRED_PROPS.closeToast).not.toHaveBeenCalled();
    component.simulate('animationEnd');
    expect(REQUIRED_PROPS.closeToast).toHaveBeenCalled();
  });
});<commit_msg>Add test for progress bar<commit_after>/* eslint-env jest */
import React from 'react';
import { shallow } from 'enzyme';

import ProgressBar from './../ProgressBar';

const REQUIRED_PROPS = {
  delay: 5000,
  isRunning: true,
  closeToast: jest.fn()
};

describe('ProgressBar', () => {
  it('Should merge className', () => {
    const component = shallow(
      <ProgressBar
        {...REQUIRED_PROPS}
        className="test"
      />
    );
    expect(component.find('.test')).toHaveLength(1);
  });

  it('Should call closeToast function when animation end', () => {
    const component = shallow(<ProgressBar {...REQUIRED_PROPS} />);

    expect(REQUIRED_PROPS.closeToast).not.toHaveBeenCalled();
    component.simulate('animationEnd');
    expect(REQUIRED_PROPS.closeToast).toHaveBeenCalled();
  });

  it("Should be able to hide the progress bar", () => {
    const component = shallow(<ProgressBar {...REQUIRED_PROPS} hide/>);
    expect(component.props().style.opacity).toBe(0);
  });
  
  it("Should be able to pause animation", () => {
    const component = shallow(<ProgressBar {...REQUIRED_PROPS} isRunning={false} />);
    expect(component.props().style.animationPlayState).toBe("paused");    
  });
});
{'fraction_non_alphanumeric': 0.16815476190476192, 'fraction_numerical': 0.005456349206349206, 'mean_word_length': 3.6689814814814814, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2618377', 'n_tokens_mistral': 633, 'n_tokens_neox': 624, 'n_words': 126}