1 import { TestBed } from '@angular/core/testing';
3 import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
4 import { MdsSummaryPipe } from './mds-summary.pipe';
6 describe('MdsSummaryPipe', () => {
7 let pipe: MdsSummaryPipe;
10 providers: [MdsSummaryPipe, i18nProviders]
14 pipe = TestBed.get(MdsSummaryPipe);
17 it('create an instance', () => {
18 expect(pipe).toBeTruthy();
21 it('transforms with 0 active and 2 standy', () => {
24 filesystems: [{ mdsmap: { info: [{ state: 'up:standby-replay' }] } }]
27 { class: '', content: '0 active' },
28 { class: 'card-text-line-break', content: '' },
29 { class: '', content: '2 standby' }
32 expect(pipe.transform(payload)).toEqual(expected);
35 it('transforms with 1 active and 1 standy', () => {
38 filesystems: [{ mdsmap: { info: [{ state: 'up:active' }] } }]
41 { class: '', content: '1 active' },
42 { class: 'card-text-line-break', content: '' },
43 { class: '', content: '1 standby' }
45 expect(pipe.transform(payload)).toEqual(expected);
48 it('transforms with 0 filesystems', () => {
53 const expected = [{ class: '', content: 'no filesystems' }];
55 expect(pipe.transform(payload)).toEqual(expected);
58 it('transforms without filesystem', () => {
59 const payload = { standbys: [0] };
61 { class: '', content: '1 up' },
62 { class: 'card-text-line-break', content: '' },
63 { class: '', content: 'no filesystems' }
66 expect(pipe.transform(payload)).toEqual(expected);
69 it('transforms without value', () => {
70 expect(pipe.transform(undefined)).toBe('');