1 import { TestBed } from '@angular/core/testing';
3 import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
5 import { MgrSummaryPipe } from './mgr-summary.pipe';
7 describe('MgrSummaryPipe', () => {
8 let pipe: MgrSummaryPipe;
11 providers: [MgrSummaryPipe, i18nProviders]
15 pipe = TestBed.get(MgrSummaryPipe);
18 it('create an instance', () => {
19 expect(pipe).toBeTruthy();
22 it('transforms without value', () => {
23 expect(pipe.transform(undefined)).toBe('');
26 it('transforms with active_name undefined', () => {
27 const payload: Record<string, any> = {
28 active_name: undefined,
32 { class: 'mgr-active-name', content: 'n/a active', titleText: '' },
33 { class: 'card-text-line-break', content: '', titleText: '' },
34 { class: '', content: '0 standby', titleText: '' }
37 expect(pipe.transform(payload)).toEqual(expected);
40 it('transforms with 1 active and 2 standbys', () => {
46 { class: 'mgr-active-name', content: '1 active', titleText: 'active daemon: a' },
47 { class: 'card-text-line-break', content: '', titleText: '' },
48 { class: '', content: '2 standby', titleText: '' }
51 expect(pipe.transform(payload)).toEqual(expected);