]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/about/about.component.spec.ts
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / core / navigation / about / about.component.spec.ts
1 import { HttpClientTestingModule } from '@angular/common/http/testing';
2 import { ComponentFixture, TestBed } from '@angular/core/testing';
3
4 import { BsModalRef } from 'ngx-bootstrap/modal';
5 import { BehaviorSubject } from 'rxjs';
6
7 import { configureTestBed } from '../../../../testing/unit-test-helper';
8 import { SummaryService } from '../../../shared/services/summary.service';
9 import { SharedModule } from '../../../shared/shared.module';
10 import { AboutComponent } from './about.component';
11
12 export class SummaryServiceMock {
13 summaryDataSource = new BehaviorSubject({
14 version:
15 'ceph version 14.0.0-855-gb8193bb4cd ' +
16 '(b8193bb4cda16ccc5b028c3e1df62bc72350a15d) nautilus (dev)',
17 mgr_host: 'http://localhost:11000/'
18 });
19 summaryData$ = this.summaryDataSource.asObservable();
20
21 subscribe(call) {
22 return this.summaryData$.subscribe(call);
23 }
24 }
25
26 describe('AboutComponent', () => {
27 let component: AboutComponent;
28 let fixture: ComponentFixture<AboutComponent>;
29
30 configureTestBed({
31 imports: [SharedModule, HttpClientTestingModule],
32 declarations: [AboutComponent],
33 providers: [BsModalRef, { provide: SummaryService, useClass: SummaryServiceMock }]
34 });
35
36 beforeEach(() => {
37 fixture = TestBed.createComponent(AboutComponent);
38 component = fixture.componentInstance;
39 fixture.detectChanges();
40 });
41
42 it('should create', () => {
43 expect(component).toBeTruthy();
44 });
45
46 it('should parse version', () => {
47 expect(component.versionNumber).toBe('14.0.0-855-gb8193bb4cd');
48 expect(component.versionHash).toBe('(b8193bb4cda16ccc5b028c3e1df62bc72350a15d)');
49 expect(component.versionName).toBe('nautilus (dev)');
50 });
51
52 it('should get host', () => {
53 expect(component.hostAddr).toBe('localhost:11000');
54 });
55 });