<commit_before>Tester.checkLeaks(false);

describe('<editor-console>', function() {
    before(function ( done ) {
        Editor.Panel.load( 'console.panel', function ( err, frameEL ) {
            document.body.appendChild(frameEL);
            done();
        });
    });

    it('should recv ipc "console:log"', function() {
        Tester.send( 'console:log', 'foo bar' );
    });

    it('should recv ipc "console:error"', function() {
        Tester.send( 'console:error', 'foo bar' );
    });
});<commit_msg>add more test case<commit_after>Tester.checkLeaks(false);

describe('<editor-console>', function() {
    var consoleEL;

    beforeEach(function ( done ) {
        Editor.sendToCore('console:clear');
        Editor.Panel.load('console.panel', function ( err, frameEL ) {
            consoleEL = frameEL;
            document.body.appendChild(frameEL);

            done();
        });
    });
    afterEach(function ( done ) {
        document.body.removeChild(consoleEL);
        consoleEL = null;
        Editor.Panel.unload('console.panel');

        done();
    });
    after(function () {
        Editor.sendToCore('console:clear');
    });

    var delay = 50;

    it('should recv ipc "console:log"', function( done ) {
        Tester.send( 'console:log', 'foo bar' );
        setTimeout( function () {
            expect( consoleEL.logs[0] ).to.deep.equal({
                type: 'log',
                text: 'foo bar',
                count: 0,
            });

            done();
        }, delay);
    });

    it('should recv ipc "console:warn"', function( done ) {
        Tester.send( 'console:warn', 'foo bar' );
        setTimeout(function () {
            expect( consoleEL.logs[0] ).to.deep.equal({
                type: 'warn',
                text: 'foo bar',
                count: 0,
            });

            done();
        }, delay);
    });

    it('should recv ipc "console:error"', function( done ) {
        Tester.send( 'console:error', 'foo bar' );
        setTimeout(function () {
            expect( consoleEL.logs[0] ).to.deep.equal({
                type: 'error',
                text: 'foo bar',
                count: 0,
            });

            done();
        }, delay);
    });

    it('should recv logs in order', function( done ) {
        Tester.send( 'console:log', 'foobar 01' );
        Tester.send( 'console:log', 'foobar 02' );
        Tester.send( 'console:error', 'foobar 03 error' );
        Tester.send( 'console:warn', 'foobar 04 warn' );
        Tester.send( 'console:log', 'foobar 05' );

        setTimeout(function () {
            expect( consoleEL.logs[0] ).to.have.property( 'text', 'foobar 01' );
            expect( consoleEL.logs[1] ).to.have.property( 'text', 'foobar 02' );
            expect( consoleEL.logs[2] ).to.have.property( 'text', 'foobar 03 error' );
            expect( consoleEL.logs[3] ).to.have.property( 'text', 'foobar 04 warn' );
            expect( consoleEL.logs[4] ).to.have.property( 'text', 'foobar 05' );

            done();
        }, delay);
    });
});
{'fraction_non_alphanumeric': 0.16845878136200718, 'fraction_numerical': 0.010752688172043012, 'mean_word_length': 1.9349904397705544, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6910972', 'n_tokens_mistral': 965, 'n_tokens_neox': 909, 'n_words': 195}