diff --git a/webui/src/app/app.component.spec.ts b/webui/src/app/app.component.spec.ts index 8836204f4..75f4560b9 100644 --- a/webui/src/app/app.component.spec.ts +++ b/webui/src/app/app.component.spec.ts @@ -1,5 +1,6 @@ import { async, TestBed } from '@angular/core/testing'; import { AppComponent } from './app.component'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; describe('AppComponent', () => { @@ -8,6 +9,9 @@ describe('AppComponent', () => { declarations: [ AppComponent ], + schemas: [ + CUSTOM_ELEMENTS_SCHEMA + ] }).compileComponents(); })); @@ -16,17 +20,5 @@ describe('AppComponent', () => { const app = fixture.debugElement.componentInstance; expect(app).toBeTruthy(); })); - - it(`should have as title 'app'`, async(() => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app.title).toEqual('app'); - })); - - it('should render title in a h1 tag', async(() => { - const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.debugElement.nativeElement; - expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); - })); + }); diff --git a/webui/src/app/charts/bar-chart/bar-chart.component.spec.ts b/webui/src/app/charts/bar-chart/bar-chart.component.spec.ts index c4d89509b..98d809215 100644 --- a/webui/src/app/charts/bar-chart/bar-chart.component.spec.ts +++ b/webui/src/app/charts/bar-chart/bar-chart.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { BarChartComponent } from './bar-chart.component'; +import { WindowService } from '../../services/window.service'; describe('BarChartComponent', () => { let component: BarChartComponent; @@ -8,7 +9,8 @@ describe('BarChartComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ BarChartComponent ] + declarations: [ BarChartComponent ], + providers: [{provide: WindowService, useInstance: {}}] }) .compileComponents(); })); @@ -16,10 +18,14 @@ describe('BarChartComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(BarChartComponent); component = fixture.componentInstance; - fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); + + it('should initially go to loading state', () => { + expect(component.loading).toBeTruthy() + }); + });