subsystem-list.component.spec.ts 1.59 KB
Newer Older
Vitali Stupin's avatar
Initial    
Vitali Stupin committed
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 { HttpClientModule } from '@angular/common/http';
Vitali Stupin's avatar
Vitali Stupin committed
4
import { RouterTestingModule } from '@angular/router/testing';
5
import { SubsystemListComponent } from './subsystem-list.component';
Vitali Stupin's avatar
Vitali Stupin committed
6
import { Component, Input } from '@angular/core';
Vitali Stupin's avatar
Vitali Stupin committed
7
8
9
import { Subsystem } from '../subsystem';
import { ActivatedRoute } from '@angular/router';
import { of } from 'rxjs';
Vitali Stupin's avatar
Vitali Stupin committed
10

Vitali Stupin's avatar
Vitali Stupin committed
11
12
13
14
15
16
@Component({selector: 'app-header', template: ''})
class HeaderStubComponent {}
@Component({selector: 'app-search', template: ''})
class SearchStubComponent {}
@Component({selector: 'app-subsystem-item', template: ''})
class SubsystemItemStubComponent {
Vitali Stupin's avatar
Vitali Stupin committed
17
  @Input() subsystem: Subsystem;
Vitali Stupin's avatar
Vitali Stupin committed
18
}
Vitali Stupin's avatar
Initial    
Vitali Stupin committed
19

20
21
22
describe('SubsystemListComponent', () => {
  let component: SubsystemListComponent;
  let fixture: ComponentFixture<SubsystemListComponent>;
Vitali Stupin's avatar
Initial    
Vitali Stupin committed
23
24
25

  beforeEach(async(() => {
    TestBed.configureTestingModule({
Vitali Stupin's avatar
Vitali Stupin committed
26
27
28
29
30
31
32
33
34
35
36
      declarations: [
        SubsystemListComponent,
        HeaderStubComponent,
        SearchStubComponent,
        SubsystemItemStubComponent
      ],
      imports: [
        TranslateModule.forRoot(),
        HttpClientModule,
        RouterTestingModule
      ]
Vitali Stupin's avatar
Initial    
Vitali Stupin committed
37
38
39
40
41
    })
    .compileComponents();
  }));

  beforeEach(() => {
Vitali Stupin's avatar
Vitali Stupin committed
42
43
    // Mocks and spies
    TestBed.get(ActivatedRoute).params = of({
Vitali Stupin's avatar
Vitali Stupin committed
44
45
      instance: 'EE'
    });
46
    fixture = TestBed.createComponent(SubsystemListComponent);
Vitali Stupin's avatar
Initial    
Vitali Stupin committed
47
48
49
50
51
52
53
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
Vitali Stupin's avatar
Vitali Stupin committed
54
});