<commit_before>import {async, ComponentFixture, TestBed} from '@angular/core/testing';

import {DataComponent} from './data.component';
import {InfiniteScrollModule} from 'ngx-infinite-scroll';
import {DataService} from '../../services/data.service';
import {HttpClientModule} from '@angular/common/http';
import {Observable} from 'rxjs/Observable';
import {logging} from '../../app.logging';
import 'rxjs/add/observable/of';
import {TranslateModule} from '@ngx-translate/core';
import {Component, ElementRef, Input, ViewChild} from '@angular/core';
import {DataSet} from '../../model/data-set';

describe('DataComponent', () => {
  let component: DataComponent;
  let fixture: ComponentFixture<DataComponent>;
  let dataService: DataService;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [DataComponent, ChartStubComponent],
      imports: [
        InfiniteScrollModule,
        HttpClientModule,
        logging,
        TranslateModule.forRoot()
      ],
      providers: [
        DataService
      ]
    })
      .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(DataComponent);
    component = fixture.componentInstance;

    dataService = fixture.debugElement.injector.get(DataService);
  });

  it('should be created', () => {
    spyOn(dataService, 'getDataSets')
      .and.returnValue(Observable.of([
      {id: '1', name: 'people', schema: null},
      {id: '2', name: 'plants', schema: null}
    ]));

    fixture.detectChanges();
    expect(component.dataSets.length).toBe(2);
  });
});

@Component({
  selector: 'app-chart',
  template: ''
})
class ChartStubComponent {<commit_msg>webui: fix tests<commit_after>import {async, ComponentFixture, TestBed} from '@angular/core/testing';

import {DataComponent} from './data.component';
import {InfiniteScrollModule} from 'ngx-infinite-scroll';
import {DataService} from '../../services/data.service';
import {HttpClientModule} from '@angular/common/http';
import {Observable} from 'rxjs/Observable';
import {logging} from '../../app.logging';
import 'rxjs/add/observable/of';
import {TranslateModule} from '@ngx-translate/core';
import {Component, ElementRef, Input, ViewChild} from '@angular/core';
import {DataSet} from '../../model/data-set';

describe('DataComponent', () => {
  let component: DataComponent;
  let fixture: ComponentFixture<DataComponent>;
  let dataService: DataService;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [DataComponent, ChartStubComponent],
      imports: [
        InfiniteScrollModule,
        HttpClientModule,
        logging,
        TranslateModule.forRoot()
      ],
      providers: [
        DataService
      ]
    })
      .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(DataComponent);
    component = fixture.componentInstance;

    dataService = fixture.debugElement.injector.get(DataService);
  });

  it('should be created', () => {
    spyOn(dataService, 'getDataSets')
      .and.returnValue(Observable.of([
      {
        id: '1',
        name: 'people',
        schema: {
          columns: []
        }
      },
      {
        id: '2',
        name: 'plants',
        schema: {
          columns: []
        }
      }
    ]));

    fixture.detectChanges();
    expect(component.dataSets.length).toBe(2);
  });
});

@Component({
  selector: 'app-chart',
  template: ''
})
class ChartStubComponent {
{'fraction_non_alphanumeric': 0.1539568345323741, 'fraction_numerical': 0.0017266187050359713, 'mean_word_length': 3.372327044025157, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '5558583', 'n_tokens_mistral': 1015, 'n_tokens_neox': 1020, 'n_words': 208}