<commit_before>import {BuildSummary} from '../BuildSummary.es6';
import {shallow} from 'enzyme';

function buildIcon(domElement){
  return domElement.find('.buildIcon').find('.fa');
}

describe("BuildSummary", () =>{
  it("should show correct failed state icon", ()=>{
    let inputProps = {buildId: 1, build: {state: 'failed'}, toggleBuildDetails: undefined};

    let component = shallow(BuildSummary(inputProps));

    expect(buildIcon(component).hasClass('fa-times')).toBe(true);
  });

  it("should show correct success state icon", ()=>{
    let inputProps = {buildId: 1, build: {state: 'success'}, toggleBuildDetails: undefined};

    let component = shallow(BuildSummary(inputProps));

    expect(buildIcon(component).hasClass('fa-check')).toBe(true);
  });

  it("should show correct running state icon", ()=>{
    let inputProps = {buildId: 1, build: {state: 'running'}, toggleBuildDetails: undefined};

    let component = shallow(BuildSummary(inputProps));

    expect(buildIcon(component).hasClass('fa-cog')).toBe(true);
  });
})
<commit_msg>add test for button click<commit_after>import {BuildSummary} from '../BuildSummary.es6';
import {shallow} from 'enzyme';

function buildIcon(domElement){
  return domElement.find('.buildIcon').find('.fa');
}

describe("BuildSummary BuildIcons", () =>{
  it("should show correct failed state icon", ()=>{
    let inputProps = {buildId: 1, build: {state: 'failed'}, toggleBuildDetails: undefined};

    let component = shallow(BuildSummary(inputProps));

    expect(buildIcon(component).hasClass('fa-times')).toBe(true);
  });

  it("should show correct success state icon", ()=>{
    let inputProps = {buildId: 1, build: {state: 'success'}, toggleBuildDetails: undefined};

    let component = shallow(BuildSummary(inputProps));

    expect(buildIcon(component).hasClass('fa-check')).toBe(true);
  });

  it("should show correct running state icon", ()=>{
    let inputProps = {buildId: 1, build: {state: 'running'}, toggleBuildDetails: undefined};

    let component = shallow(BuildSummary(inputProps));

    expect(buildIcon(component).hasClass('fa-cog')).toBe(true);
  });
});

describe("BuildSummary Toggle", ()=>{
  it("should call the toggle details function on click", ()=>{
    let toggleFnMock = jest.fn();
    let inputProps = {buildId: 1, build: {state: 'running'}, toggleBuildDetails: toggleFnMock};

    let component = shallow(BuildSummary(inputProps));
    component.find(".buildDetailsToggle").simulate('click');

    expect(toggleFnMock).toBeCalled();

  })
});

{'fraction_non_alphanumeric': 0.17094354520331623, 'fraction_numerical': 0.0035530990919857876, 'mean_word_length': 5.350877192982456, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '7478693', 'n_tokens_mistral': 748, 'n_tokens_neox': 723, 'n_words': 172}