1 import { HttpClientTestingModule } from '@angular/common/http/testing';
2 import { ComponentFixture, TestBed } from '@angular/core/testing';
3 import { RouterTestingModule } from '@angular/router/testing';
5 import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation';
6 import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
7 import { TabsetComponent, TabsModule } from 'ngx-bootstrap/tabs';
8 import { of } from 'rxjs';
9 import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
10 import { CoreModule } from '../../../../core/core.module';
11 import { OrchestratorService } from '../../../../shared/api/orchestrator.service';
12 import { CdTableSelection } from '../../../../shared/models/cd-table-selection';
13 import { Permissions } from '../../../../shared/models/permissions';
14 import { CephModule } from '../../../ceph.module';
15 import { HostDetailsComponent } from './host-details.component';
17 describe('HostDetailsComponent', () => {
18 let component: HostDetailsComponent;
19 let fixture: ComponentFixture<HostDetailsComponent>;
23 HttpClientTestingModule,
25 BsDropdownModule.forRoot(),
26 NgBootstrapFormValidationModule.forRoot(),
32 providers: [i18nProviders]
36 fixture = TestBed.createComponent(HostDetailsComponent);
37 component = fixture.componentInstance;
38 component.selection = new CdTableSelection();
39 component.permissions = new Permissions({
43 const orchService = TestBed.get(OrchestratorService);
44 spyOn(orchService, 'status').and.returnValue(of({ available: true }));
45 spyOn(orchService, 'inventoryDeviceList').and.returnValue(of([]));
46 spyOn(orchService, 'serviceList').and.returnValue(of([]));
47 fixture.detectChanges();
50 it('should create', () => {
51 expect(component).toBeTruthy();
54 describe('Host details tabset', () => {
56 component.selection.selected = [
63 it('should recognize a tabset child', () => {
64 fixture.detectChanges();
65 const tabsetChild: TabsetComponent = component.tabsetChild;
66 expect(tabsetChild).toBeDefined();
69 it('should show tabs', () => {
70 fixture.detectChanges();
71 const tabs = component.tabsetChild.tabs.map((tab) => tab.heading);
72 expect(tabs).toEqual(['Devices', 'Inventory', 'Services', 'Performance Details']);