]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/relative-date.pipe.spec.ts
import 15.2.4
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / pipes / relative-date.pipe.spec.ts
CommitLineData
11fdf7f2
TL
1import * as moment from 'moment';
2
3import { RelativeDatePipe } from './relative-date.pipe';
4
5describe('RelativeDatePipe', () => {
6 const pipe = new RelativeDatePipe();
7
8 it('create an instance', () => {
9 expect(pipe).toBeTruthy();
10 });
11
12 it('transforms without value', () => {
9f95a23c 13 expect(pipe.transform(undefined)).toBe('unknown');
11fdf7f2
TL
14 });
15
16 it('transforms "in 7 days"', () => {
e306af50 17 const value = moment().add(7, 'days').unix();
11fdf7f2
TL
18 expect(pipe.transform(value)).toBe('in 7 days');
19 });
20
21 it('transforms "7 days ago"', () => {
e306af50 22 const value = moment().subtract(7, 'days').unix();
11fdf7f2
TL
23 expect(pipe.transform(value)).toBe('7 days ago');
24 });
25});