subsystem.component.spec.ts 1.79 KB
Newer Older
1
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
Vitali Stupin's avatar
Vitali Stupin committed
2
3
import { TranslateModule } from '@ngx-translate/core';
import { Component } from '@angular/core';
4
import { SubsystemComponent } from './subsystem.component';
Vitali Stupin's avatar
Vitali Stupin committed
5
6
import { RouterTestingModule } from '@angular/router/testing';
import { HttpClientModule } from '@angular/common/http';
Vitali Stupin's avatar
Vitali Stupin committed
7
8
// import { ViewportScroller } from '@angular/common';
// import { SubsystemsService } from '../methods.service';
Vitali Stupin's avatar
Vitali Stupin committed
9
10
11
12
13
import { ActivatedRoute } from '@angular/router';
import { of } from 'rxjs';

@Component({selector: 'app-header', template: ''})
class HeaderStubComponent {}
14
15
16
17
18
19
20

describe('SubsystemComponent', () => {
  let component: SubsystemComponent;
  let fixture: ComponentFixture<SubsystemComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
Vitali Stupin's avatar
Vitali Stupin committed
21
22
23
24
25
      declarations: [
        SubsystemComponent,
        HeaderStubComponent
      ],
      imports: [
Vitali Stupin's avatar
Vitali Stupin committed
26
        TranslateModule.forRoot(),
Vitali Stupin's avatar
Vitali Stupin committed
27
28
29
30
        HttpClientModule,
        RouterTestingModule
      ]/*,
      providers: [
Vitali Stupin's avatar
Vitali Stupin committed
31
        SubsystemsService
Vitali Stupin's avatar
Vitali Stupin committed
32
      ]*/
33
34
35
36
37
    })
    .compileComponents();
  }));

  beforeEach(() => {
Vitali Stupin's avatar
Vitali Stupin committed
38
39
    // Mocks and spies
    TestBed.get(ActivatedRoute).params = of({
Vitali Stupin's avatar
Vitali Stupin committed
40
41
42
43
44
45
      instance: 'EE',
      class: 'CLASS',
      member: 'MEMBER',
      subsystem: 'SYSTEM'
    });
    // spyOn(TestBed.get(ViewportScroller), "scrollToPosition").and.callFake(() => {});
Vitali Stupin's avatar
Vitali Stupin committed
46

47
48
49
50
51
    fixture = TestBed.createComponent(SubsystemComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

Vitali Stupin's avatar
Vitali Stupin committed
52
53
54
55
  /*afterEach(() => {
    TestBed.resetTestEnvironment()
  });*/

56
57
58
  it('should create', () => {
    expect(component).toBeTruthy();
  });
Vitali Stupin's avatar
Vitali Stupin committed
59
60
61
62

  /*it('scrollToPosition was called', async(() => {
    expect(TestBed.get(ViewportScroller).scrollToPosition).toHaveBeenCalledWith([0, 0])
  }));*/
63
});