feat: Shows the last activity, created at timestamp in the same row (#6267)

This commit is contained in:
Sivin Varghese
2023-01-23 21:50:16 +05:30
committed by GitHub
parent 487d90207b
commit 9782f71bdf
7 changed files with 126 additions and 11 deletions

View File

@@ -8,3 +8,38 @@ describe('#messageStamp', () => {
);
});
});
describe('#dynamicTime', () => {
it('returns correct value', () => {
expect(TimeMixin.methods.dynamicTime(1612971343)).toEqual(
'almost 2 years ago'
);
});
});
describe('#dateFormat', () => {
it('returns correct value', () => {
expect(TimeMixin.methods.dateFormat(1612971343)).toEqual('Feb 10, 2021');
expect(TimeMixin.methods.dateFormat(1612971343, 'LLL d, yyyy')).toEqual(
'Feb 10, 2021'
);
});
});
describe('#shortTimestamp', () => {
it('returns correct value', () => {
expect(TimeMixin.methods.shortTimestamp('less than a minute ago')).toEqual(
'now'
);
expect(TimeMixin.methods.shortTimestamp(' minute ago')).toEqual('m');
expect(TimeMixin.methods.shortTimestamp(' minutes ago')).toEqual('m');
expect(TimeMixin.methods.shortTimestamp(' hour ago')).toEqual('h');
expect(TimeMixin.methods.shortTimestamp(' hours ago')).toEqual('h');
expect(TimeMixin.methods.shortTimestamp(' day ago')).toEqual('d');
expect(TimeMixin.methods.shortTimestamp(' days ago')).toEqual('d');
expect(TimeMixin.methods.shortTimestamp(' month ago')).toEqual('mo');
expect(TimeMixin.methods.shortTimestamp(' months ago')).toEqual('mo');
expect(TimeMixin.methods.shortTimestamp(' year ago')).toEqual('y');
expect(TimeMixin.methods.shortTimestamp(' years ago')).toEqual('y');
});
});