app.component.spec.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import {AppComponent} from './app.component';
  2. import {HsConfig} from 'hslayers-ng';
  3. import {TestBed, waitForAsync} from '@angular/core/testing';
  4. class HsConfigMock {
  5. constructor() {}
  6. }
  7. describe('AppComponent', () => {
  8. beforeEach(
  9. waitForAsync(() => {
  10. TestBed.configureTestingModule({
  11. declarations: [AppComponent],
  12. providers: [{provide: HsConfig, useValue: new HsConfigMock()}],
  13. }).compileComponents();
  14. })
  15. );
  16. it('should create the app', () => {
  17. const fixture = TestBed.createComponent(AppComponent);
  18. const app = fixture.componentInstance;
  19. expect(app).toBeTruthy();
  20. });
  21. it(`should have as title 'hslayers-application'`, () => {
  22. const fixture = TestBed.createComponent(AppComponent);
  23. const app = fixture.componentInstance;
  24. expect(app.title).toEqual('hslayers-application');
  25. });
  26. it('should render title', () => {
  27. const fixture = TestBed.createComponent(AppComponent);
  28. fixture.detectChanges();
  29. const compiled = fixture.nativeElement;
  30. expect(compiled.querySelector('.content span').textContent).toContain(
  31. 'hslayers-workspace app is running!'
  32. );
  33. });
  34. });