<commit_before>import React from 'react';
import { mount } from 'enzyme';
import sinon from 'sinon';
import CreditCardNumberInput from '../../../app/javascript/BuiltInFormControls/CreditCardNumberInput';

describe('CreditCardNumberInput', () => {
  const onChange = sinon.spy();
  const renderCreditCardNumberInput = props => mount(<CreditCardNumberInput
    id="ccNumber"
    onChange={onChange}
    {...props}
  />);

  test('it renders a default credit card image when there is no value', () => {
    const component = renderCreditCardNumberInput();
    expect(component.find('.input-group-addon i').prop('className')).toEqual('fa fa-credit-card');
  });

  test('it renders a Visa credit card image when it is a Visa card', () => {
    const component = renderCreditCardNumberInput({ value: '4242424242424242' });
    expect(component.find('.input-group-addon i').prop('className')).toEqual('fa fa-cc-visa text-success');
  });

  test('it renders a MasterCard credit card image when it is a MasterCard card', () => {
    const component = renderCreditCardNumberInput({ value: '5555555555554444' });
    expect(component.find('.input-group-addon i').prop('className')).toEqual('fa fa-cc-mastercard text-success');
  });

  test('it renders an Amex credit card image when it is an Amex card', () => {
    const component = renderCreditCardNumberInput({ value: '378282246310005' });
    expect(component.find('.input-group-addon i').prop('className')).toEqual('fa fa-cc-amex text-success');
  });

  test('it renders a Discover credit card image when it is a Discover card', () => {
    const component = renderCreditCardNumberInput({ value: '6011111111111117' });
    expect(component.find('.input-group-addon i').prop('className')).toEqual('fa fa-cc-discover text-success');
  });

  test('it renders a Diners Club credit card image when it is a Diners Club card', () => {
    const component = renderCreditCardNumberInput({ value: '30569309025904' });
    expect(component.find('.input-group-addon i').prop('className')).toEqual('fa fa-cc-dinersclub text-success');
  });

  test('it renders a JCB credit card image when it is a JCB card', () => {
    const component = renderCreditCardNumberInput({ value: '3530111333300000' });
    expect(component.find('.input-group-addon i').prop('className')).toEqual('fa fa-cc-jcb text-success');
  });

  test('it renders a black icon when it is a partial card number', () => {
    const component = renderCreditCardNumberInput({ value: '42424242424242' });
    expect(component.find('.input-group-addon i').prop('className')).toEqual('fa fa-cc-visa');
  });

  test('it renders an error icon when it is an invalid card number', () => {
    const component = renderCreditCardNumberInput({ value: '4242424242424243' });
    expect(component.find('.input-group-addon i').prop('className')).toEqual('fa fa-exclamation-triangle text-danger');
  });
});<commit_msg>Fix test expectation after changing an element class, rawr<commit_after>import React from 'react';
import { mount } from 'enzyme';
import sinon from 'sinon';
import CreditCardNumberInput from '../../../app/javascript/BuiltInFormControls/CreditCardNumberInput';

describe('CreditCardNumberInput', () => {
  const onChange = sinon.spy();
  const renderCreditCardNumberInput = props => mount(<CreditCardNumberInput
    id="ccNumber"
    onChange={onChange}
    {...props}
  />);

  test('it renders a default credit card image when there is no value', () => {
    const component = renderCreditCardNumberInput();
    expect(component.find('.input-group-append i').prop('className')).toEqual('fa fa-credit-card');
  });

  test('it renders a Visa credit card image when it is a Visa card', () => {
    const component = renderCreditCardNumberInput({ value: '4242424242424242' });
    expect(component.find('.input-group-append i').prop('className')).toEqual('fa fa-cc-visa text-success');
  });

  test('it renders a MasterCard credit card image when it is a MasterCard card', () => {
    const component = renderCreditCardNumberInput({ value: '5555555555554444' });
    expect(component.find('.input-group-append i').prop('className')).toEqual('fa fa-cc-mastercard text-success');
  });

  test('it renders an Amex credit card image when it is an Amex card', () => {
    const component = renderCreditCardNumberInput({ value: '378282246310005' });
    expect(component.find('.input-group-append i').prop('className')).toEqual('fa fa-cc-amex text-success');
  });

  test('it renders a Discover credit card image when it is a Discover card', () => {
    const component = renderCreditCardNumberInput({ value: '6011111111111117' });
    expect(component.find('.input-group-append i').prop('className')).toEqual('fa fa-cc-discover text-success');
  });

  test('it renders a Diners Club credit card image when it is a Diners Club card', () => {
    const component = renderCreditCardNumberInput({ value: '30569309025904' });
    expect(component.find('.input-group-append i').prop('className')).toEqual('fa fa-cc-dinersclub text-success');
  });

  test('it renders a JCB credit card image when it is a JCB card', () => {
    const component = renderCreditCardNumberInput({ value: '3530111333300000' });
    expect(component.find('.input-group-append i').prop('className')).toEqual('fa fa-cc-jcb text-success');
  });

  test('it renders a black icon when it is a partial card number', () => {
    const component = renderCreditCardNumberInput({ value: '42424242424242' });
    expect(component.find('.input-group-append i').prop('className')).toEqual('fa fa-cc-visa');
  });

  test('it renders an error icon when it is an invalid card number', () => {
    const component = renderCreditCardNumberInput({ value: '4242424242424243' });
    expect(component.find('.input-group-append i').prop('className')).toEqual('fa fa-exclamation-triangle text-danger');
  });
});
{'fraction_non_alphanumeric': 0.15837026934878964, 'fraction_numerical': 0.041936583702693486, 'mean_word_length': 4.657666345226615, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, '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': '6035957', 'n_tokens_mistral': 1882, 'n_tokens_neox': 1687, 'n_words': 448}