1 import { HttpClientTestingModule } from '@angular/common/http/testing';
2 import { ComponentFixture, TestBed } from '@angular/core/testing';
4 import { BsModalRef } from 'ngx-bootstrap/modal';
5 import { BehaviorSubject } from 'rxjs';
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';
12 export class SummaryServiceMock {
13 summaryDataSource = new BehaviorSubject({
15 'ceph version 14.0.0-855-gb8193bb4cd ' +
16 '(b8193bb4cda16ccc5b028c3e1df62bc72350a15d) nautilus (dev)',
17 mgr_host: 'http://localhost:11000/'
19 summaryData$ = this.summaryDataSource.asObservable();
22 return this.summaryData$.subscribe(call);
26 describe('AboutComponent', () => {
27 let component: AboutComponent;
28 let fixture: ComponentFixture<AboutComponent>;
31 imports: [SharedModule, HttpClientTestingModule],
32 declarations: [AboutComponent],
33 providers: [BsModalRef, { provide: SummaryService, useClass: SummaryServiceMock }]
37 fixture = TestBed.createComponent(AboutComponent);
38 component = fixture.componentInstance;
39 fixture.detectChanges();
42 it('should create', () => {
43 expect(component).toBeTruthy();
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)');
52 it('should get host', () => {
53 expect(component.hostAddr).toBe('localhost:11000');