Removed non-applicable default tests and fixed custom tests

This commit is contained in:
Manfred Dreese 2018-09-21 16:44:02 +02:00 committed by Traefiker Bot
parent f63873cc73
commit 9ab5cbf235
2 changed files with 13 additions and 15 deletions

View file

@ -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!');
}));
});

View file

@ -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()
});
});