uppy/packages/@uppy/utils/src/getETA.test.js
Antoine du Hamel 51ecc66e64
@uppy/utils: refactor to TS (#4699)
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
Co-authored-by: Nick Rutten <2504906+nickrttn@users.noreply.github.com>
Co-authored-by: Murderlon <merlijn@soverin.net>
Co-authored-by: Artur Paikin <artur@arturpaikin.com>
2023-11-06 15:01:50 +01:00

15 lines
458 B
JavaScript

import { describe, expect, it } from 'vitest'
import getETA from './getETA.ts'
describe('getETA', () => {
it('should get the ETA remaining based on a fileProgress object', () => {
const dateNow = new Date()
const date5SecondsAgo = new Date(dateNow.getTime() - 5 * 1000)
const fileProgress = {
bytesUploaded: 1024,
bytesTotal: 3096,
uploadStarted: date5SecondsAgo,
}
expect(getETA(fileProgress)).toEqual(10.1)
})
})