1 | const getSpeed = require('./getSpeed')
|
2 |
|
3 | describe('getSpeed', () => {
|
4 | it('should calculate the speed given a fileProgress object', () => {
|
5 | const dateNow = new Date()
|
6 | const date5SecondsAgo = new Date(dateNow.getTime() - 5 * 1000)
|
7 | const fileProgress = {
|
8 | bytesUploaded: 1024,
|
9 | uploadStarted: date5SecondsAgo
|
10 | }
|
11 | expect(Math.round(getSpeed(fileProgress))).toEqual(Math.round(205))
|
12 | })
|
13 | })
|