<commit_before>import React from 'react';
import TestUtils from 'react-addons-test-utils';
import expect from 'expect';
import expectJSX from 'expect-jsx';
expect.extend(expectJSX);

import File from '../file';
import Progress from '../progress';
import FileViewModel from '../../viewmodels/file.viewmodel';

const noRefCheck = () => {};

describe('file component', () => {
    it('should render file', () => {
        const file = new FileViewModel();
        file.name = 'test.jpg';
        file.size = 1024;
        file.mimeType = 'image/jpeg';
        file.date = new Date();

        const renderer = TestUtils.createRenderer();
        renderer.render(<File file={file} onDeleteFile={noRefCheck} />);

        const actualElement = renderer.getRenderOutput();
        const expectedElement = (<li className="collection-item file">
            <div className="file-name">test.jpg</div>
            <div className="file-size">1.00 Kb</div>
        </li>);
        expect(actualElement).toEqualJSX(expectedElement);
    });

    it('should render file and delete button', () => {
        const file = new FileViewModel();
        file.name = 'test.jpg';
        file.size = 1024;
        file.mimeType = 'image/jpeg';
        file.date = new Date();

        const renderer = TestUtils.createRenderer();
        renderer.render(<File file={file} showDeleteButton onDeleteFile={noRefCheck} />);

        const actualElement = renderer.getRenderOutput();
        const expectedElement = (<li className="collection-item file">
            <div className="file-name">test.jpg</div>
            <div className="file-size">1.00 Kb</div>
            <a className="remove-button" onClick={noRefCheck}>
                <i className="material-icons">delete</i>
            </a>
        </li>);
        expect(actualElement).toEqualJSX(expectedElement);
    });

    it('should render file with progress bar while uploading', () => {
        const file = new FileViewModel();
        file.name = 'test.jpg';
        file.size = 1024;
        file.mimeType = 'image/jpeg';
        file.date = new Date();
        file.isUploading = true;
        file.uploadedPercentage = 17;

        const renderer = TestUtils.createRenderer();
        renderer.render(<File file={file} onDeleteFile={noRefCheck} />);

        const actualElement = renderer.getRenderOutput();
        const expectedElement = (<li className="collection-item file">
            <div className="file-name">test.jpg</div>
            <div className="file-size">1.00 Kb</div>
            <Progress value={17} />
        </li>);
        expect(actualElement).toEqualJSX(expectedElement);
    });
});
<commit_msg>moved include "expectJSX" to normal code (instead of "Import" area)<commit_after>import React from 'react';
import TestUtils from 'react-addons-test-utils';
import expect from 'expect';
import expectJSX from 'expect-jsx';

import File from '../file';
import Progress from '../progress';
import FileViewModel from '../../viewmodels/file.viewmodel';

const noRefCheck = () => {};

expect.extend(expectJSX);

describe('file component', () => {
    it('should render file', () => {
        const file = new FileViewModel();
        file.name = 'test.jpg';
        file.size = 1024;
        file.mimeType = 'image/jpeg';
        file.date = new Date();

        const renderer = TestUtils.createRenderer();
        renderer.render(<File file={file} onDeleteFile={noRefCheck} />);

        const actualElement = renderer.getRenderOutput();
        const expectedElement = (<li className="collection-item file">
            <div className="file-name">test.jpg</div>
            <div className="file-size">1.00 Kb</div>
        </li>);
        expect(actualElement).toEqualJSX(expectedElement);
    });

    it('should render file and delete button', () => {
        const file = new FileViewModel();
        file.name = 'test.jpg';
        file.size = 1024;
        file.mimeType = 'image/jpeg';
        file.date = new Date();

        const renderer = TestUtils.createRenderer();
        renderer.render(<File file={file} showDeleteButton onDeleteFile={noRefCheck} />);

        const actualElement = renderer.getRenderOutput();
        const expectedElement = (<li className="collection-item file">
            <div className="file-name">test.jpg</div>
            <div className="file-size">1.00 Kb</div>
            <a className="remove-button" onClick={noRefCheck}>
                <i className="material-icons">delete</i>
            </a>
        </li>);
        expect(actualElement).toEqualJSX(expectedElement);
    });

    it('should render file with progress bar while uploading', () => {
        const file = new FileViewModel();
        file.name = 'test.jpg';
        file.size = 1024;
        file.mimeType = 'image/jpeg';
        file.date = new Date();
        file.isUploading = true;
        file.uploadedPercentage = 17;

        const renderer = TestUtils.createRenderer();
        renderer.render(<File file={file} onDeleteFile={noRefCheck} />);

        const actualElement = renderer.getRenderOutput();
        const expectedElement = (<li className="collection-item file">
            <div className="file-name">test.jpg</div>
            <div className="file-size">1.00 Kb</div>
            <Progress value={17} />
        </li>);
        expect(actualElement).toEqualJSX(expectedElement);
    });
});

{'fraction_non_alphanumeric': 0.14696604193727963, 'fraction_numerical': 0.009278159213212098, 'mean_word_length': 2.6296296296296298, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 65, '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': '6329135', 'n_tokens_mistral': 1555, 'n_tokens_neox': 1470, 'n_words': 339}