diff options
Diffstat (limited to 'src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.spec.ts')
-rw-r--r-- | src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.spec.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.spec.ts new file mode 100644 index 000000000..b67ed62c8 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.spec.ts @@ -0,0 +1,24 @@ +import { DatePipe } from '@angular/common'; + +import moment from 'moment'; + +import { CdDatePipe } from './cd-date.pipe'; + +describe('CdDatePipe', () => { + const datePipe = new DatePipe('en-US'); + let pipe = new CdDatePipe(datePipe); + + it('create an instance', () => { + pipe = new CdDatePipe(datePipe); + expect(pipe).toBeTruthy(); + }); + + it('transforms without value', () => { + expect(pipe.transform('')).toBe(''); + }); + + it('transforms with some date', () => { + const result = moment(1527085564486).format('M/D/YY LTS'); + expect(pipe.transform(1527085564486)).toBe(result); + }); +}); |