<commit_before>import React from 'react';
import {shallow} from 'enzyme';
import {expect} from 'chai';
import sinon from 'sinon';

import {testQuestion} from '../../test_fixtures.js';
import Examples from './examples.jsx';
import TextField from 'material-ui/TextField';

function testProps(props){
  return ({
    type: 'Good',
    examplesText: testQuestion.examples.join('\n\n'),
    onExamplesChange: sinon.spy(),
    ...props
  });
}

describe('<EditingComponent.Examples />', ()=>{
  it('renders the correct good examples text', ()=>{
    const props = testProps();
    const wrapper = shallow(<Examples {...props} />);
    console.log(wrapper.debug());
    const text = testQuestion.examples.join('\n\n');
    expect(wrapper.find(TextField)).to.have.length(1);
    expect(wrapper.find(TextField).props().value).to.equal(text);
  });<commit_msg>Added test for bad examples text in authoring UI<commit_after>import React from 'react';
import {shallow} from 'enzyme';
import {expect} from 'chai';
import sinon from 'sinon';

import {testQuestion} from '../../test_fixtures.js';
import Examples from './examples.jsx';
import TextField from 'material-ui/TextField';

function testProps(props){
  return ({
    type: 'Good',
    examplesText: testQuestion.examples.join('\n\n'),
    onExamplesChange: sinon.spy(),
    ...props
  });
}

describe('<EditingComponent.Examples />', ()=>{
  it('renders the correct good examples text', ()=>{
    const props = testProps();
    const wrapper = shallow(<Examples {...props} />);
    const text = testQuestion.examples.join('\n\n');
    expect(wrapper.find(TextField)).to.have.length(1);
    expect(wrapper.find(TextField).props().value).to.equal(text);
  });
  it('renders the correct bad examples text', ()=>{
    const text = testQuestion.nonExamples.join('\n\n');
    const props = testProps({
      type: 'Bad',
      examplesText: text
    });
    const wrapper = shallow(<Examples {...props} />);
    expect(wrapper.find(TextField)).to.have.length(1);
    expect(wrapper.find(TextField).props().value).to.equal(text);

  });
{'fraction_non_alphanumeric': 0.1808972503617945, 'fraction_numerical': 0.001447178002894356, 'mean_word_length': 4.070904645476773, 'pattern_counts': {'":': 0, '<': 8, '<?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': '6442060', 'n_tokens_mistral': 643, 'n_tokens_neox': 627, 'n_words': 145}