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 { async, TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
describe('AppComponent', () => { describe('AppComponent', () => {
@ -8,6 +9,9 @@ describe('AppComponent', () => {
declarations: [ declarations: [
AppComponent AppComponent
], ],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
]
}).compileComponents(); }).compileComponents();
})); }));
@ -17,16 +21,4 @@ describe('AppComponent', () => {
expect(app).toBeTruthy(); 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 { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { BarChartComponent } from './bar-chart.component'; import { BarChartComponent } from './bar-chart.component';
import { WindowService } from '../../services/window.service';
describe('BarChartComponent', () => { describe('BarChartComponent', () => {
let component: BarChartComponent; let component: BarChartComponent;
@ -8,7 +9,8 @@ describe('BarChartComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ BarChartComponent ] declarations: [ BarChartComponent ],
providers: [{provide: WindowService, useInstance: {}}]
}) })
.compileComponents(); .compileComponents();
})); }));
@ -16,10 +18,14 @@ describe('BarChartComponent', () => {
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(BarChartComponent); fixture = TestBed.createComponent(BarChartComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges();
}); });
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
it('should initially go to loading state', () => {
expect(component.loading).toBeTruthy()
});
}); });