diff options
Diffstat (limited to 'src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts')
-rw-r--r-- | src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts new file mode 100644 index 000000000..b62fce9d9 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts @@ -0,0 +1,55 @@ +import { Component, Input } from '@angular/core'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SharedModule } from '~/app/shared/shared.module'; +import { configureTestBed } from '~/testing/unit-test-helper'; +import { CephfsDetailComponent } from './cephfs-detail.component'; + +@Component({ selector: 'cd-cephfs-chart', template: '' }) +class CephfsChartStubComponent { + @Input() + mdsCounter: any; +} + +describe('CephfsDetailComponent', () => { + let component: CephfsDetailComponent; + let fixture: ComponentFixture<CephfsDetailComponent>; + + const updateDetails = ( + standbys: string, + pools: any[], + ranks: any[], + mdsCounters: object, + name: string + ) => { + component.data = { + standbys, + pools, + ranks, + mdsCounters, + name + }; + fixture.detectChanges(); + }; + + configureTestBed({ + imports: [SharedModule], + declarations: [CephfsDetailComponent, CephfsChartStubComponent] + }); + + beforeEach(() => { + fixture = TestBed.createComponent(CephfsDetailComponent); + component = fixture.componentInstance; + updateDetails('b', [], [], { a: { name: 'a', x: [0], y: [0, 1] } }, 'someFs'); + fixture.detectChanges(); + component.ngOnChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('prepares standby on change', () => { + expect(component.standbys).toEqual([{ key: 'Standby daemons', value: 'b' }]); + }); +}); |