@uppy/utils
Version:
Shared utility functions for Uppy Core and plugins maintained by the Uppy team.
15 lines (14 loc) • 517 B
JavaScript
import { describe, expect, it } from 'vitest';
import getETA from './getETA.js';
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.getTime(),
};
expect(getETA(fileProgress)).toEqual(10.1);
});
});