<commit_before>import renderer from 'react-test-renderer'

import AllowDuplicatesCheckbox from '../../../app/assets/javascripts/components/allow-duplicates-checkbox.jsx'

describe('AllowDuplicatesCheckbox', () => {
  let component = null
  let isAllowed = false

  const props = {
    checked: isAllowed,
    onChange: allowed => { isAllowed = allowed }
  }

  beforeEach(() => {
    component = <AllowDuplicatesCheckbox {...props} />
  })

  test('matches snapshot', () => {
    const tree = renderer.create(component).toJSON()
    expect(tree).toMatchSnapshot()
  })
})
<commit_msg>Test dupes checkbox notices changes<commit_after>import renderer from 'react-test-renderer'
import { shallow } from 'enzyme'

import AllowDuplicatesCheckbox from '../../../app/assets/javascripts/components/allow-duplicates-checkbox.jsx'

describe('AllowDuplicatesCheckbox', () => {
  let component = null
  let isAllowed = false

  const props = {
    checked: isAllowed,
    onChange: allowed => { isAllowed = allowed }
  }

  beforeEach(() => {
    component = <AllowDuplicatesCheckbox {...props} />
  })

  test('matches snapshot', () => {
    const tree = renderer.create(component).toJSON()
    expect(tree).toMatchSnapshot()
  })

  test('notices when checkbox is toggled', () => {
    const checkbox = shallow(component).find('#allow-duplicates')
    checkbox.simulate('change', { target: { checked: true } })
    expect(isAllowed).toBe(true)
  })
})

{'fraction_non_alphanumeric': 0.15256588072122051, 'fraction_numerical': 0.0, 'mean_word_length': 3.8422818791946307, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '1888550', 'n_tokens_mistral': 440, 'n_tokens_neox': 438, 'n_words': 87}