]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.spec.ts
import 15.2.4
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / cluster / hosts / host-details / host-details.component.spec.ts
1 import { HttpClientTestingModule } from '@angular/common/http/testing';
2 import { ComponentFixture, TestBed } from '@angular/core/testing';
3 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
4 import { RouterTestingModule } from '@angular/router/testing';
5
6 import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation';
7 import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
8 import { TabsModule } from 'ngx-bootstrap/tabs';
9 import { ToastrModule } from 'ngx-toastr';
10
11 import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
12 import { CoreModule } from '../../../../core/core.module';
13 import { Permissions } from '../../../../shared/models/permissions';
14 import { SharedModule } from '../../../../shared/shared.module';
15 import { CephModule } from '../../../ceph.module';
16 import { CephSharedModule } from '../../../shared/ceph-shared.module';
17 import { HostDetailsComponent } from './host-details.component';
18
19 describe('HostDetailsComponent', () => {
20 let component: HostDetailsComponent;
21 let fixture: ComponentFixture<HostDetailsComponent>;
22
23 configureTestBed({
24 imports: [
25 BrowserAnimationsModule,
26 HttpClientTestingModule,
27 TabsModule.forRoot(),
28 BsDropdownModule.forRoot(),
29 NgBootstrapFormValidationModule.forRoot(),
30 RouterTestingModule,
31 CephModule,
32 CoreModule,
33 CephSharedModule,
34 SharedModule,
35 ToastrModule.forRoot()
36 ],
37 declarations: [],
38 providers: [i18nProviders]
39 });
40
41 beforeEach(() => {
42 fixture = TestBed.createComponent(HostDetailsComponent);
43 component = fixture.componentInstance;
44 component.selection = undefined;
45 component.permissions = new Permissions({
46 hosts: ['read'],
47 grafana: ['read']
48 });
49 });
50
51 it('should create', () => {
52 expect(component).toBeTruthy();
53 });
54
55 describe('Host details tabset', () => {
56 beforeEach(() => {
57 component.selection = { hostname: 'localhost' };
58 fixture.detectChanges();
59 });
60
61 it('should recognize a tabset child', () => {
62 const tabsetChild = component.tabsetChild;
63 expect(tabsetChild).toBeDefined();
64 });
65
66 it('should show tabs', () => {
67 expect(component.tabsetChild.tabs.map((t) => t.heading)).toEqual([
68 'Devices',
69 'Device health',
70 'Inventory',
71 'Daemons',
72 'Performance Details'
73 ]);
74 });
75 });
76 });