import { SharedModule } from './shared/shared.module' ; import { async , ComponentFixture , TestBed } from '@angular/core/testing' ; import { APP_BASE_HREF } from '@angular/common' ; import { Route } from '@angular/router' ; import { RouterTestingModule } from '@angular/router/testing' ; import { Component } from '@angular/core' ; import { HomeComponent } from './home/home.component' ; import { AppModule } from './app.module' ; import { AppBrowserModule } from './app.browser.module' ; import { EnvConfig } from '../../../tools/config/app.config' ; import { ENV_CONFIG } from './app.config' ; import { EnvironmentService } from './shared/services/environment.service' ; import { Angulartics2Module } from 'angulartics2' ; import { Angulartics2GoogleAnalytics } from 'angulartics2/ga' ; import { HttpClientTestingModule } from '@angular/common/http/testing' ; import { NavbarService } from './shared/navbar/navbar.service' ; import { MatCardModule } from '@angular/material' ; import { AngularFireDatabase } from 'angularfire2/database' ; import { Observable } from 'rxjs/Observable' ; import { AuthService } from './shared/services/auth.service' ; import '../operators' ; export const TESTING_CONFIG = { name : 'Fusebox Angular Universal Starter' , description : 'Seed project for Angular Universal apps featuring Server-Side Rendering (SSR), FuseBox, dev/prod builds, Brotli/Gzip, SCSS, favicon generation, @types, unit testing w/ Jest, and sitemap generator. Created by Patrick Michalina' , firebase : { } as any , endpoints : { api : 'http://localhost:8000/api' , websocketServer : 'ws://localhost:8001' } , host : 'http://localhost:8083' } ; @ Component ( { selector : 'test-cmp' , template : '<pm-app></pm-app>' } ) class TestComponent { } describe ( 'App component' , ( ) => { const config = [ { path : '' , component : HomeComponent } ] ; let fixture ; beforeEach ( async ( ( ) => { TestBed . configureTestingModule ( { imports : [ AppModule , AppBrowserModule , SharedModule , HttpClientTestingModule , RouterTestingModule . withRoutes ( config ) , Angulartics2Module . forRoot ( [ Angulartics2GoogleAnalytics ] ) , MatCardModule ] , declarations : [ TestComponent , HomeComponent ] , providers : [ { provide : APP_BASE_HREF , useValue : '/' } , { provide : ENV_CONFIG , useValue : TESTING_CONFIG } , { provide : AuthService , useValue : { } } , { provide : AngularFireDatabase , useValue : { object : ( ) => { return { snapshotChanges : ( ) => Observable . of ( ) , valueChanges : ( ) => Observable . of ( ) } ; } , list : ( ) => { return { snapshotChanges : ( ) => Observable . of ( ) , valueChanges : ( ) => Observable . of ( ) } ; } } } , EnvironmentService , NavbarService ] } ) . compileComponents ( ) ; } ) ) ; beforeEach ( async ( ( ) => { fixture = TestBed . createComponent ( TestComponent ) ; } ) ) ; afterEach ( async ( ( ) => { TestBed . resetTestingModule ( ) ; } ) ) ; it ( 'should build without a problem' , async ( ( ) => { expect ( fixture . nativeElement ) . toBeTruthy ( ) ; expect ( fixture . nativeElement ) . toMatchSnapshot ( ) ; } ) ) ; } ) ;