<commit_before>/*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { Observable } from 'rxjs/Observable';
import { DejaEditorComponent } from './deja-editor.component';
import { DejaEditorService } from './deja-editor.service';

describe('DejaEditorComponent', () => {
    let component: DejaEditorComponent;
    let fixture: ComponentFixture<DejaEditorComponent>;
    let originalTimeout: number;

    beforeEach(async(() => {
        // Define a ckeditor base path just for tests, because webpack configuration or asset plugin not working
        (<any>window).CKEDITOR_BASEPATH = 'https://dsi-hug.github.io/dejajs-components/assets/ckeditor/';

        originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
        jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;

        TestBed.configureTestingModule({
            declarations: [
                DejaEditorComponent,
            ],
            imports: [
            ],
            providers: [DejaEditorService]
        }).compileComponents();

        fixture = TestBed.createComponent(DejaEditorComponent);
        component = fixture.componentInstance;
    }));

    afterEach(() => {
        jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
    });

    it('should create the component', async(() => {
        expect(component).toBeTruthy();
    }));

    it('should load ckeditor', (done) => {
        fixture.detectChanges();
        fixture.whenStable().then(() => {
            Observable.timer(5000).subscribe(() => {
                expect(window.hasOwnProperty('CKEDITOR')).toBeTruthy();
                expect(fixture.debugElement.query(By.css('iframe'))).toBeDefined();
                done();
            });
        });
    });
});<commit_msg>test(CkEditor): Fix CkEditor test timeout<commit_after>/*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { Observable } from 'rxjs/Observable';
import { DejaEditorComponent } from './deja-editor.component';
import { DejaEditorService } from './deja-editor.service';

describe('DejaEditorComponent', () => {
    let component: DejaEditorComponent;
    let fixture: ComponentFixture<DejaEditorComponent>;

    beforeEach(async(() => {
        // Define a ckeditor base path just for tests, because webpack configuration or asset plugin not working
        (<any>window).CKEDITOR_BASEPATH = 'https://dsi-hug.github.io/dejajs-components/assets/ckeditor/';

        TestBed.configureTestingModule({
            declarations: [
                DejaEditorComponent,
            ],
            imports: [
            ],
            providers: [DejaEditorService]
        }).compileComponents();

        fixture = TestBed.createComponent(DejaEditorComponent);
        component = fixture.componentInstance;
    }));

    it('should create the component', async(() => {
        expect(component).toBeTruthy();
    }));

    it('should load ckeditor', (done) => {
        fixture.detectChanges();
        fixture.whenStable().then(() => {
            Observable.timer(5000).subscribe(() => {
                expect(window.hasOwnProperty('CKEDITOR')).toBeTruthy();
                expect(fixture.debugElement.query(By.css('iframe'))).toBeDefined();
                done();
            });
        });
    }, 10000);
});
{'fraction_non_alphanumeric': 0.12985685071574643, 'fraction_numerical': 0.005623721881390593, 'mean_word_length': 2.802721088435374, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 20, 'https://': 4, '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': '3865195', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1072, 'n_words': 227}