github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/webapp/javascript/components/TimelineChart/getFormatLabel.spec.ts (about) 1 import getFormatLabel from './getFormatLabel'; 2 3 describe('getFormatLabel renders correct time format if:', () => { 4 it('time distance is less than 12h - [HH:mm:ss]', () => { 5 expect( 6 getFormatLabel({ 7 date: 1662113437142.8572, 8 timezone: 'utc', 9 xaxis: { max: 1662114305000, min: 1662112505000 }, 10 }) 11 ).toEqual('10:10:37'); 12 }); 13 14 it('time distance is between 12h and 24h - [HH:mm]', () => { 15 expect( 16 getFormatLabel({ 17 date: 1662091559736.842, 18 timezone: 'utc', 19 xaxis: { max: 1662114865000, min: 1662071665000 }, 20 }) 21 ).toEqual('04:05'); 22 }); 23 24 it('time distance is greater than 12h - [MMM do HH:mm]', () => { 25 expect( 26 getFormatLabel({ 27 date: 1661611895545.1128, 28 timezone: 'utc', 29 xaxis: { max: 1662114865000, min: 1661510165000 }, 30 }) 31 ).toEqual('Aug 27th 14:51'); 32 }); 33 34 it('incorrect input - [???]', () => { 35 expect( 36 getFormatLabel({ 37 date: 123123123123123333, 38 timezone: 'utc', 39 xaxis: { min: -1, max: -2 }, 40 }) 41 ).toEqual('???'); 42 }); 43 });