update dependencies and fix unit tests

This commit is contained in:
Sebastian Peischl
2018-02-19 21:12:37 +01:00
parent 1ae6f7aedc
commit 4d3ca6e1b1
9 changed files with 155 additions and 128 deletions

View File

@@ -2,6 +2,7 @@ import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
import { ElectronService } from 'app/providers/electron.service';
import { TranslateModule } from '@ngx-translate/core';
describe('AppComponent', () => {
beforeEach(async(() => {
@@ -12,7 +13,10 @@ describe('AppComponent', () => {
providers : [
ElectronService
],
imports: [RouterTestingModule]
imports: [
RouterTestingModule,
TranslateModule.forRoot()
]
}).compileComponents();
}));

View File

@@ -1,6 +1,6 @@
import 'zone.js/dist/zone-mix';
import 'reflect-metadata';
import 'polyfills';
import '../polyfills';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
@@ -15,7 +15,7 @@ import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { ElectronService } from './providers/electron.service';
import { WebviewDirective } from 'app/directives/webview.directive';
import { WebviewDirective } from './directives/webview.directive';
import { AppComponent } from './app.component';
import { HomeComponent } from './components/home/home.component';

View File

@@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
import { TranslateModule } from '@ngx-translate/core';
describe('HomeComponent', () => {
let component: HomeComponent;
@@ -8,7 +9,8 @@ describe('HomeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HomeComponent ]
declarations: [ HomeComponent ],
imports: [ TranslateModule.forRoot() ]
})
.compileComponents();
}));
@@ -23,16 +25,10 @@ describe('HomeComponent', () => {
expect(component).toBeTruthy();
});
it(`should have as title 'App works !'`, async(() => {
fixture = TestBed.createComponent(HomeComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('App works !');
}));
it('should render title in a h1 tag', async(() => {
fixture = TestBed.createComponent(HomeComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('App works !');
expect(compiled.querySelector('h1').textContent).toContain('PAGES.HOME.TITLE');
}));
});