mirror of
https://github.com/transloadit/uppy.git
synced 2026-08-01 14:31:15 +00:00
14 lines
467 B
JavaScript
14 lines
467 B
JavaScript
import { describe, expect, it } from '@jest/globals'
|
|
import getSpeed from './getSpeed.js'
|
|
|
|
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))
|
|
})
|
|
})
|