getETA.test.js 413 B

1234567891011121314
  1. const getETA = require('./getETA')
  2. describe('getETA', () => {
  3. it('should get the ETA remaining based on a fileProgress object', () => {
  4. const dateNow = new Date()
  5. const date5SecondsAgo = new Date(dateNow.getTime() - 5 * 1000)
  6. const fileProgress = {
  7. bytesUploaded: 1024,
  8. bytesTotal: 3096,
  9. uploadStarted: date5SecondsAgo
  10. }
  11. expect(getETA(fileProgress)).toEqual(10.1)
  12. })
  13. })