summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/log-priority.pipe.spec.ts
blob: 45d677c2abae057ad8d64d046dbe7b41b5de3ac4 (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
26
27
28
29
30
31
32
import { LogPriorityPipe } from './log-priority.pipe';

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

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

  it('transforms "INF"', () => {
    const value = '[INF]';
    const result = 'info';
    expect(pipe.transform(value)).toEqual(result);
  });

  it('transforms "WRN"', () => {
    const value = '[WRN]';
    const result = 'warn';
    expect(pipe.transform(value)).toEqual(result);
  });

  it('transforms "ERR"', () => {
    const value = '[ERR]';
    const result = 'err';
    expect(pipe.transform(value)).toEqual(result);
  });

  it('transforms others', () => {
    const value = '[foo]';
    expect(pipe.transform(value)).toBe('');
  });
});