<commit_before>import DomMock from '../../helpers/dom-mock';
import jsdom from 'mocha-jsdom';
import expect from 'expect';
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import SurveyList from '../../../portal/src/components/List/SurveyList';

DomMock('<html><body></body></html>');

describe('[Portal] Testing SurveyList Component', () => {
    jsdom({ skipWindowCheck: true });

    const props = {
        surveys: [
            {
                accountid: 'facebook-00000',
                subject: 'I am Questionnaire',
                surveyid: '11111-0000-2222-3333',
                datetime: 1470380181870
            },{
                accountid: 'facebook-00000',
                subject: 'TODOS',
                surveyid: '2222-3333-4444-0000',
                datetime: 1470301920229
            }],
        selectedSurveys: '2222-3333-4444-0000',
        questionsActions: () => {},
        surveysActions: () => {}
    };
    const content = TestUtils.renderIntoDocument(
        <SurveyList {...props} />
    );

    it('survey list: count surveys number', () => {
        const list = TestUtils.scryRenderedDOMComponentsWithClass(content, 'ut-list');
        expect(list.length).toEqual(2);
    });

    it('survey list: choose survey', () => {
        const input = TestUtils.scryRenderedDOMComponentsWithTag(content, 'input');
        expect(input[0].checked).toEqual(false);
        expect(input[1].checked).toEqual(true);
    });
});<commit_msg>Adjust SurveyList unit test<commit_after>import DomMock from '../../helpers/dom-mock';
import jsdom from 'mocha-jsdom';
import expect from 'expect';
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import SurveyList from '../../../portal/src/components/List/SurveyList';

DomMock('<html><body></body></html>');

describe('[Portal] Testing SurveyList Component', () => {
    jsdom({ skipWindowCheck: true });

    const props = {
        surveys: [
            {
                accountid: 'facebook-00000',
                subject: 'I am Questionnaire',
                surveyid: '11111-0000-2222-3333',
                datetime: 1470380181870
            },{
                accountid: 'facebook-00000',
                subject: 'TODOS',
                surveyid: '2222-3333-4444-0000',
                datetime: 1470301920229
            }],
        selectedSurveys: '2222-3333-4444-0000',
        questionsActions: () => {},
        surveysActions: {
            toggleSelectedSurveys: (val) => {
                props.selectedSurveys = val;
            }
        }
    };
    const content = TestUtils.renderIntoDocument(
        <SurveyList {...props} />
    );

    it('survey list: count surveys number', () => {
        const list = TestUtils.scryRenderedDOMComponentsWithClass(content, 'ut-list');
        expect(list.length).toEqual(2);
    });

    it('survey list: selected survey', () => {
        const input = TestUtils.scryRenderedDOMComponentsWithTag(content, 'input');
        expect(input[0].checked).toEqual(false);
        expect(input[1].checked).toEqual(true);
    });

    it('survey list: change selected survey', () => {
        const input = TestUtils.scryRenderedDOMComponentsWithTag(content, 'input');
        TestUtils.Simulate.change(input[0]);
        expect(props.selectedSurveys).toEqual(input[0].value);
    });
});
{'fraction_non_alphanumeric': 0.14992592592592593, 'fraction_numerical': 0.05274074074074074, 'mean_word_length': 2.332675222112537, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 24, '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': '1873683', 'n_tokens_mistral': 1084, 'n_tokens_neox': 956, 'n_words': 182}