summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/map.pipe.spec.ts
blob: 337d5c37b28a7aff6aa860602885a8f912aed9ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { MapPipe } from './map.pipe';

describe('MapPipe', () => {
  const pipe = new MapPipe();

  it('create an instance', () => {
    expect(pipe).toBeTruthy();
  });

  it('map value [1]', () => {
    expect(pipe.transform('foo')).toBe('foo');
  });

  it('map value [2]', () => {
    expect(pipe.transform('foo', { '-1': 'disabled', 0: 'unlimited' })).toBe('foo');
  });

  it('map value [3]', () => {
    expect(pipe.transform(-1, { '-1': 'disabled', 0: 'unlimited' })).toBe('disabled');
  });

  it('map value [4]', () => {
    expect(pipe.transform(0, { '-1': 'disabled', 0: 'unlimited' })).toBe('unlimited');
  });
});