Adds tests for src/core/Utils
Ports translator tests to jest
Adds tests for core/index
Added code coverage report
Adds tests for core/UppySocket
Adds tests to src/core and cleanup of test directory
Switched from import to require as the project supports node v4
Runs tests using Babel for backwards compatibilty
Adds src/core state tests
Adds src/core reset & close tests
Updates stagnant snapshot
Adds tests for preprocessors and postprocessors in src/core/Core.js
Adds tests for uploaders and metadata in src/core/Core
Adds tests for adding and removing files in src/core/Core
Adds test for getFile
Each upload() now generates a unique ID and stores the relevant file IDs
in state. It now also keeps track of which `step` in the 'pipeline' the
upload is at.
Since uploads are now stored in state, I added two methods to manage
them:
- `createUpload(fileIDs)` to create a new upload. It returns the unique
ID for the upload.
- `removeUpload(uploadID)` to remove an upload, because it was
completed or canceled.
I split off the 'pipeline' logic from the `upload()` method, into a new
private method `runUpload(uploadID)`, and added a `restore(uploadID)`
method that can be used to continue a preexisting upload. `runUpload()`
continues at the `step` stored in state.
The Golden Retriever loops through the existing uploads from the
restored state and `restore(uploadID)`s each of them.
This speeds up the UI a ton by not reconciling every time if state
is updated frequently. For example, when adding 20 files at once,
previously the UI would reconcile after adding each file, which took
a few ms each time. Especially on a not-supercomputer that could
easily hang the UI for a second or more.
This way the UI reconciliation is sort of detached from the state
updates, and only reconciles up to 60 times per second. In the bulk file
adding case, it only reconciles once after all files have been added.