diff options
Diffstat (limited to 'src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/map.pipe.spec.ts')
-rw-r--r-- | src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/map.pipe.spec.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/map.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/map.pipe.spec.ts new file mode 100644 index 000000000..337d5c37b --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/map.pipe.spec.ts @@ -0,0 +1,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'); + }); +}); |