<commit_before>/*
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

import { HttpClientTestingModule } from '@angular/common/http/testing';
import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { FormsModule } from '@angular/forms';
import { By } from '@angular/platform-browser';
import { HttpService } from '../../../http.service';
import { UploadComponent } from '../../../second/components/upload/upload.component';
import { UploadService } from '../../../second/components/upload/upload.service';
import { ChildComponent } from '../child/child.component';
import { FirstComponent } from './first.component';

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

    beforeEach(async(() => {
        TestBed.configureTestingModule({
            declarations: [FirstComponent, UploadComponent, ChildComponent],
            imports: [HttpClientTestingModule, FormsModule],
            providers: [UploadService, HttpService]
        })
            .compileComponents();
    }));

    beforeEach(() => {
        fixture = TestBed.createComponent(FirstComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
    });

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


    it('should filter the array of the child element', fakeAsync(() => {
        const childValue = 'm';
        dispatchInputEventOnElement('#searchField', childValue);

        const tableCell = fixture
            .debugElement
            .query(By.css('#mytable'))
            .nativeElement;
        console.log(tableCell.rows[0].cells[0].innerHTML);

        expect(tableCell.rows[0].cells[0].innerHTML).toBe('mega');
    }));

    function dispatchInputEventOnElement(selector: string, value: string) {

        const input = fixture.debugElement.query(By.css(selector)).nativeElement;
        input.value = value;

        input.dispatchEvent(new Event('input'));
        fixture.detectChanges();
        tick();
    }
});
<commit_msg>Remove console.log<commit_after>/*
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

import { HttpClientTestingModule } from '@angular/common/http/testing';
import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { FormsModule } from '@angular/forms';
import { By } from '@angular/platform-browser';
import { HttpService } from '../../../http.service';
import { UploadComponent } from '../../../second/components/upload/upload.component';
import { UploadService } from '../../../second/components/upload/upload.service';
import { ChildComponent } from '../child/child.component';
import { FirstComponent } from './first.component';

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

    beforeEach(async(() => {
        TestBed.configureTestingModule({
            declarations: [FirstComponent, UploadComponent, ChildComponent],
            imports: [HttpClientTestingModule, FormsModule],
            providers: [UploadService, HttpService]
        })
            .compileComponents();
    }));

    beforeEach(() => {
        fixture = TestBed.createComponent(FirstComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
    });

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


    it('should filter the array of the child element', fakeAsync(() => {
        const childValue = 'm';
        dispatchInputEventOnElement('#searchField', childValue);

        const tableCell = fixture
            .debugElement
            .query(By.css('#mytable'))
            .nativeElement;

        expect(tableCell.rows[0].cells[0].innerHTML).toBe('mega');
    }));

    function dispatchInputEventOnElement(selector: string, value: string) {

        const input = fixture.debugElement.query(By.css(selector)).nativeElement;
        input.value = value;

        input.dispatchEvent(new Event('input'));
        fixture.detectChanges();
        tick();
    }
});

{'fraction_non_alphanumeric': 0.1257936507936508, 'fraction_numerical': 0.0011904761904761906, 'mean_word_length': 3.2648054145516077, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '13283', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1252, 'n_words': 370}