<commit_before>import test from 'ava';
import { shallow } from 'enzyme';
import sinon from 'sinon';

import React, { Component } from 'react';
import Section from '../../src/components/form/FormSection';
import FormField from '../../src/components/form/FormField';
require('ignore-styles')


test('sectionkey is correct', t => {
    const withOnlySectionKey = <Section sectionKey={"testKey"} elements={[]} />;
    const wrapper = shallow(withOnlySectionKey);
    const expected =  <div key={"section" + "testKey"}><br />
                            <h1 className="ui dividing header"></h1>
                     </div>
    
    t.truthy(wrapper.contains(expected));
});

test('header is correct', t => {
    const headerText = "testHeader";
    const withHeaderOnly =  <Section header={headerText} elements={[]} />;
    const wrapper = shallow(withHeaderOnly);
    const expectedHeader = <h1 className="ui dividing header">{headerText}</h1>;
    t.truthy(wrapper.contains(expectedHeader));
});

test.only('when element is added, it creates FormField object', t => {
    const field = <FormField fieldKey="key" fieldData="data" />
    const stub = sinon.stub(field);
    const object = {fieldKey: "key" , fieldData: "data"};
    const array = [object];
    const formSection = <Section elements= {array} />
    t.truthy(stub.called);
})<commit_msg>perkele<commit_after>import test from 'ava';
import { shallow } from 'enzyme';
import sinon from 'sinon';

import React, { Component } from 'react';
import Section from '../../src/components/form/FormSection';
import FormField from '../../src/components/form/FormField';
require('ignore-styles')


test('sectionkey is correct', t => {
    const withOnlySectionKey = <Section sectionKey={"testKey"} elements={[]} />;
    const wrapper = shallow(withOnlySectionKey);
    const expected =  <div key={"section" + "testKey"}><br />
                            <h1 className="ui dividing header"></h1>
                     </div>
    
    t.truthy(wrapper.contains(expected));
});

test('header is correct', t => {
    const headerText = "testHeader";
    const withHeaderOnly =  <Section header={headerText} elements={[]} />;
    const wrapper = shallow(withHeaderOnly);
    const expectedHeader = <h1 className="ui dividing header">{headerText}</h1>;
    t.truthy(wrapper.contains(expectedHeader));
});

test.only('when element is added, it creates FormField object', t => {

    const fieldData = {
        inputType: "input",
        name: "someTestName",
        label: "Testing label",
        placeholder: "test placeholder"
    };
    const fieldOnChangeSpy = () => {};
  
    const element = {fieldData: {fieldData}, 
                     fieldOnChangeFunc: {fieldOnChangeSpy}};
    const array = [element];
    const expected =<FormField fieldKey= {0}
                    fieldData={fieldData}
                    fieldOnChangeFunc= {fieldOnChangeSpy}
                    />;
    const section = <Section sectionKey="Ww" header="en" elements = {array} />
    const wrapper = shallow(section);
    console.log("wrapper")
    console.log(wrapper.debug());
    console.log("########################");
    console.log("expected");
    console.log(expected);
    t.truthy(wrapper.contains(expected));
})
{'fraction_non_alphanumeric': 0.15881809787626963, 'fraction_numerical': 0.002770083102493075, 'mean_word_length': 3.2428198433420365, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 32, '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': '2336724', 'n_tokens_mistral': 926, 'n_tokens_neox': 914, 'n_words': 230}