1 import { TestBed } from '@angular/core/testing';
3 import { configureTestBed } from '~/testing/unit-test-helper';
4 import { MgrSummaryPipe } from './mgr-summary.pipe';
6 describe('MgrSummaryPipe', () => {
7 let pipe: MgrSummaryPipe;
10 providers: [MgrSummaryPipe]
14 pipe = TestBed.inject(MgrSummaryPipe);
17 it('create an instance', () => {
18 expect(pipe).toBeTruthy();
21 it('transforms without value', () => {
22 expect(pipe.transform(undefined)).toBe('');
25 it('transforms with active_name undefined', () => {
26 const payload: Record<string, any> = {
27 active_name: undefined,
31 { class: 'popover-info', content: 'n/a active', titleText: '' },
32 { class: 'card-text-line-break', content: '', titleText: '' },
33 { class: 'popover-info', content: '0 standby', titleText: '' }
36 expect(pipe.transform(payload)).toEqual(expected);
39 it('transforms with 1 active and 2 standbys', () => {
42 standbys: [{ name: 'y' }, { name: 'z' }]
45 { class: 'popover-info', content: '1 active', titleText: 'active daemon: x' },
46 { class: 'card-text-line-break', content: '', titleText: '' },
47 { class: 'popover-info', content: '2 standby', titleText: 'standby daemons: y, z' }
50 expect(pipe.transform(payload)).toEqual(expected);