formatTimeLeft.test.ts
1 import { formatTimeLeft } from '../src/helpers/fomatTimeLeft' 2 import { expect } from 'chai' 3 4 describe('formatTimeLeft', () => { 5 it('seconds left', () => { 6 expect(formatTimeLeft(10)).to.eq('10 seconds left') 7 }) 8 it('hours left', () => { 9 expect(formatTimeLeft(8000)).to.eq('2 hours left') 10 }) 11 it('days left', () => { 12 expect(formatTimeLeft(172800)).to.eq('2 days left') 13 }) 14 it('seconds ago', () => { 15 expect(formatTimeLeft(-10)).to.eq('Vote ended') 16 }) 17 it('hours ago', () => { 18 expect(formatTimeLeft(-8000)).to.eq('Vote ended') 19 }) 20 it('days ago', () => { 21 expect(formatTimeLeft(-172800)).to.eq('Vote ended') 22 }) 23 })