diff --git a/web-ui/src/app/app.component.spec.ts b/web-ui/src/app/app.component.spec.ts index bcbdf36..8a042df 100644 --- a/web-ui/src/app/app.component.spec.ts +++ b/web-ui/src/app/app.component.spec.ts @@ -1,11 +1,30 @@ import { TestBed, async } from '@angular/core/testing'; import { AppComponent } from './app.component'; + +import { TranslateModule } from '@ngx-translate/core'; +import { RouterTestingModule } from '@angular/router/testing'; + +import { DEFAULT_LANG, LanguageService } from './services/language.service'; + +import { NO_ERRORS_SCHEMA, } from '@angular/core'; + describe('AppComponent', () => { + + const languageServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('LanguageService', ['getLang']); + beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ AppComponent ], + imports: [ + TranslateModule.forRoot(), + RouterTestingModule + ], + providers: [ + { provide: LanguageService, useValue: languageServiceSpy }, + ], + schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); })); it('should create the app', async(() => { @@ -13,15 +32,4 @@ 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!'); - })); });