]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/osd-summary.pipe.spec.ts
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / pipes / osd-summary.pipe.spec.ts
CommitLineData
1e59de90
TL
1import { TestBed } from '@angular/core/testing';
2
3import { configureTestBed } from '~/testing/unit-test-helper';
4import { OsdSummaryPipe } from './osd-summary.pipe';
5
6describe('OsdSummaryPipe', () => {
7 let pipe: OsdSummaryPipe;
8
9 configureTestBed({
10 providers: [OsdSummaryPipe]
11 });
12
13 beforeEach(() => {
14 pipe = TestBed.inject(OsdSummaryPipe);
15 });
16
17 it('create an instance', () => {
18 expect(pipe).toBeTruthy();
19 });
20
21 it('transforms without value', () => {
22 expect(pipe.transform(undefined)).toBe('');
23 });
24
25 it('transforms having 3 osd with 3 up, 3 in, 0 down, 0 out', () => {
26 const value = {
27 osds: [
28 { up: 1, in: 1, state: ['up', 'exists'] },
29 { up: 1, in: 1, state: ['up', 'exists'] },
30 { up: 1, in: 1, state: ['up', 'exists'] }
31 ]
32 };
33 expect(pipe.transform(value)).toEqual({
34 total: 3,
35 down: 0,
36 out: 0,
37 up: 3,
38 in: 3,
39 nearfull: 0,
40 full: 0
41 });
42 });
43});