<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 { Portal } from '../../../portal/src/containers/Portal';
import FBLogin from '../../../portal/src/components/FBLogin';
import Subject from '../../../portal/src/components/Popup/Subject';

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

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

    const props = {
        loading: false,
        token: 'xxxx',
        account: {},
        subject: '',
        surveyID: '',
        editSubject: false,
        preview: '',
        previewID: '',
        routing: {},
        editSubjectActions: () => {},
        subjectActions: () => {},
        questionsActions: () => {},
        previewActions: () => {},
        accountActions: () => {}
    };

    it('Portal: FB Login', () => {
        const content = TestUtils.renderIntoDocument(<Portal {...props} />);
        const fb = TestUtils.scryRenderedComponentsWithType(content, FBLogin);
        expect(fb.length).toEqual(1);
    });

    it('Portal: edit subject popup', () => {
        const editProps = Object.assign({}, props,
            { editSubject: true });
        const content = TestUtils.renderIntoDocument(<Portal {...editProps} />);
        const subject = TestUtils.findRenderedComponentWithType(content, Subject);
        expect(subject).toExist();
    });
});<commit_msg>Adjust unit test for new props webpage<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 { Portal } from '../../../portal/src/containers/Portal';
import FBLogin from '../../../portal/src/components/FBLogin';
import Subject from '../../../portal/src/components/Popup/Subject';

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

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

    const props = {
        loading: false,
        token: 'xxxx',
        account: {},
        subject: '',
        surveyID: '',
        editSubject: false,
        preview: '',
        previewID: '',
        webpage: 'index',
        routing: {},
        editSubjectActions: () => {},
        subjectActions: () => {},
        questionsActions: () => {},
        previewActions: () => {},
        accountActions: () => {}
    };

    it('Portal: FB Login', () => {
        const content = TestUtils.renderIntoDocument(<Portal {...props} />);
        const fb = TestUtils.scryRenderedComponentsWithType(content, FBLogin);
        expect(fb.length).toEqual(1);
    });

    it('Portal: edit subject popup', () => {
        const editProps = Object.assign({}, props,
            { editSubject: true });
        const content = TestUtils.renderIntoDocument(<Portal {...editProps} />);
        const subject = TestUtils.findRenderedComponentWithType(content, Subject);
        expect(subject).toExist();
    });
});
{'fraction_non_alphanumeric': 0.17982597486303578, 'fraction_numerical': 0.0006445375443119562, 'mean_word_length': 2.6474735605170387, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 31, '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': '3502448', 'n_tokens_mistral': 868, 'n_tokens_neox': 872, 'n_words': 188}