import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { HomeComponent } from './home.component'; import {Component} from '@angular/core'; import {By} from '@angular/platform-browser'; @Component({selector: 'app-login', template: ''}) class LoginStubComponent {} describe('HomeComponent', () => { let component: HomeComponent; let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ HomeComponent, LoginStubComponent ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(HomeComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); it('should load the login component', () => { expect(fixture.debugElement.query(By.css('app-login'))).toBeTruthy(); }); });