<commit_before>import React from 'react'
import { shallow } from 'enzyme'
import Counter from '../Counter'

const theme = {}
const leftOperatorClick = function (component) {
  const incrementValue = component.state.count + 1
  component.setState({
    count: incrementValue,
  })
}
const rightOperatorClick = function (component) {
  if (component.state.count > 1) {
    const decrementValue = component.state.count - 1
    component.setState({
      count: decrementValue,
    })
  }
}
describe('Counter', () => {
  it('renders a Counter', () => {
    const wrapper = shallow(<Counter theme={theme} />)
    expect(wrapper.find('.leftUnit')).toHaveLength(1)
  })

  it('passes through props', () => {
    const wrapper = shallow(<Counter id="foo" theme={theme} />)
    expect(wrapper.prop('id')).toEqual('foo')
  })
  it('passes through props', () => {
    const wrapper = shallow(<Counter id="foo" theme={theme} count={3} />)
    expect(wrapper.state('count')).toEqual(3)
  })

  it('passes through default count state', () => {
    const wrapper = shallow(<Counter id="foo" theme={theme} />)
    expect(wrapper.state('count')).toEqual(1)
  })

  describe('when counter button clicked', () => {
    it('calls a increment callback', () => {
      const wrapper = shallow(<Counter id='foo' theme={theme} leftOperatorClick={leftOperatorClick} rightOperatorClick={rightOperatorClick} />)
      wrapper.find('span').first().simulate('click')
      expect(wrapper.state('count')).toEqual(2)
    })
    it('calls a decrement callback', () => {
      const wrapper = shallow(<Counter id='foo' count={3} theme={theme} count={2} leftOperatorClick={leftOperatorClick} rightOperatorClick={rightOperatorClick} />)
      wrapper.find('span').last().simulate('click')
      expect(wrapper.state('count')).toEqual(1)
    })
  })
})<commit_msg>Some indentation changes in counter-test.js<commit_after>import React from 'react'
import { shallow } from 'enzyme'
import Counter from '../Counter'

const theme = {}
const leftOperatorClick = function (component) {
  const incrementValue = component.state.count + 1
  component.setState({
    count: incrementValue,
  })
}
const rightOperatorClick = function (component) {
  if (component.state.count > 1) {
    const decrementValue = component.state.count - 1
    component.setState({
      count: decrementValue,
    })
  }
}
describe('Counter', () => {
  it('renders a Counter', () => {
    const wrapper = shallow(<Counter theme={theme} />)
    expect(wrapper.find('.leftUnit')).toHaveLength(1)
  })

  it('passes through props', () => {
    const wrapper = shallow(<Counter id="foo" theme={theme} />)
    expect(wrapper.prop('id')).toEqual('foo')
  })
  it('passes through props', () => {
    const wrapper = shallow(<Counter id="foo" theme={theme} count={3} />)
    expect(wrapper.state('count')).toEqual(3)
  })

  it('passes through default count state', () => {
    const wrapper = shallow(<Counter id="foo" theme={theme} />)
    expect(wrapper.state('count')).toEqual(1)
  })

  describe('when counter button clicked', () => {
    it('calls a increment callback', () => {
      const wrapper = shallow(
          <Counter
            id='foo'
            theme={theme}
            leftOperatorClick={leftOperatorClick}
            rightOperatorClick={rightOperatorClick}
          />,
      )
      wrapper.find('span').first().simulate('click')
      expect(wrapper.state('count')).toEqual(2)
    })
    it('calls a decrement callback', () => {
      const wrapper = shallow(
          <Counter
            id='foo'
            count={3}
            theme={theme}
            count={2}
            leftOperatorClick={leftOperatorClick}
            rightOperatorClick={rightOperatorClick}
          />,
      )
      wrapper.find('span').last().simulate('click')
      expect(wrapper.state('count')).toEqual(1)
    })
  })
})
{'fraction_non_alphanumeric': 0.16821946169772256, 'fraction_numerical': 0.005693581780538302, 'mean_word_length': 3.3870601589103293, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 33, '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': '6344182', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1117, 'n_words': 226}