uppy/packages/@uppy/utils/src/getSpeed.test.js
Renée Kooi 2e257b7e55
Move utils files to @uppy/utils package.
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
```
2018-06-14 16:31:19 +02:00

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))
})
})