mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-22 17:58:05 +00:00
And rewrite all the require calls. ```bash git mv src/utils/* packages/@uppy/utils/src sed -i 's/[./]*\/utils\//@uppy\/utils\/lib\//' src/**/*.js # transform (../)*utils → @uppy/utils ```
13 lines
415 B
JavaScript
13 lines
415 B
JavaScript
const getSpeed = require('./getSpeed')
|
|
|
|
describe('getSpeed', () => {
|
|
it('should calculate the speed given a fileProgress object', () => {
|
|
const dateNow = new Date()
|
|
const date5SecondsAgo = new Date(dateNow.getTime() - 5 * 1000)
|
|
const fileProgress = {
|
|
bytesUploaded: 1024,
|
|
uploadStarted: date5SecondsAgo
|
|
}
|
|
expect(Math.round(getSpeed(fileProgress))).toEqual(Math.round(205))
|
|
})
|
|
})
|