-
Notifications
You must be signed in to change notification settings - Fork 14
[RAINCATCH-1388] Filestore tests #180
[RAINCATCH-1388] Filestore tests #180
Conversation
ping @JameelB |
} | ||
|
||
/** | ||
* Returns the full path to a file stored with the service | ||
* @param fileName Name of the file to build a path for, usually the file's id | ||
*/ | ||
export function buildFilePath(fileName) { | ||
export function buildFilePath(fileName: string, root: string = FILE_STORAGE_DIRECTORY) { | ||
return path.join(FILE_STORAGE_DIRECTORY, fileName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the FILE_STORAGE_DIRECTORY
have to be changed to root
?
680e5d4
to
6a32ae9
Compare
Changes Unknown when pulling 6a32ae9 on RAINCATCH-1388-filestore-tests into ** on file-storage-support**. |
1 similar comment
Changes Unknown when pulling 6a32ae9 on RAINCATCH-1388-filestore-tests into ** on file-storage-support**. |
Changes Unknown when pulling 8c70948 on RAINCATCH-1388-filestore-tests into ** on file-storage-support**. |
8c70948
to
589cb44
Compare
Changes Unknown when pulling 589cb44 on RAINCATCH-1388-filestore-tests into ** on file-storage-support**. |
1 similar comment
Changes Unknown when pulling 589cb44 on RAINCATCH-1388-filestore-tests into ** on file-storage-support**. |
Changes Unknown when pulling 4f3adc1 on RAINCATCH-1388-filestore-tests into ** on file-storage-support**. |
BTW The snyk vulns are fixed since the express version has been updated to match the other packages, and they wouldn't affect a server since the only usage of express from inside the filestore package is to export a router that is run on the server's non-vulnerable express version. The warning should go away as we publish a new version. |
Changes Unknown when pulling e58c657 on RAINCATCH-1388-filestore-tests into ** on file-storage-support**. |
1 similar comment
Changes Unknown when pulling e58c657 on RAINCATCH-1388-filestore-tests into ** on file-storage-support**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified
> nyc mocha
GridFsStorage
✓ should write and read back a file from storage (51ms)
constructor
✓ should accept a mongodb connection
FileService
createTemporaryStorageFolder
✓ should create a default directory
✓ should be idempotent
writeStreamToFile
✓ should write data to the file identified by id
buildFilePath
✓ should return a relative path to the root directory
multerMiddleware
✓ should return a middleware
✓ should accept other storage implementations
8 passing (143ms)
-------------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
-------------------|----------|----------|----------|----------|----------------|
All files | 85.71 | 58.33 | 75 | 84.62 | |
impl | 80.95 | 50 | 72.73 | 80.49 | |
GridFsStorage.ts | 80.95 | 50 | 72.73 | 80.49 |... 56,68,76,77 |
services | 92.86 | 66.67 | 77.78 | 91.67 | |
FileService.ts | 92.86 | 66.67 | 77.78 | 91.67 | 42,59 |
-------------------|----------|----------|----------|----------|----------------|```
* Start refactoring for tests * Add some tests for filestore * Add tests for writeStreamToFile * Finish tests for fileService * Lower coverage reqs * Rename storage class to match filename * Add string type for createTemporaryStorageFolder * Add first tests for gridfs storage * Add tests for gridfs * Update jsdocs * Update package version to pre-release one * update dependencies to match hoisted versions * Fix hanging test
* RAINCATCH-1351 - File Server (#156) * WIP file sync client (#159) * Use fetch api from filestore-client (#163) * Use fetch to upload data * Use fetch for download * Improve upload calls * [RAINCATCH-1350] Add camera package to support camera step (#164) * Move camera class from step * adjust package versions * Add filestore dependency * Remove data uri responsibility from file-upload * Add index for exporting public interface * Add used deps * Add FileEntry interface, use updload from camera module * Add todo item * Fix typescript compilation errors (#166) * Fix initialization callback order (#167) * Minor tweaks (#168) * Minor tweaks * Refactoring * Temporary untested changes * Change filesystem query to resolveLocalFileSystemUrl (#170) * Http file support * fix file-store api (#174) * Add interfaces to file manager (#173) * Split files for interfaces, add httpclient interface * Use interfaces from relevant code * Fix type typo * Add extra metadata to post request (#175) * Remove extra route param * Delete subproject * Include extra metadata in post data * [RAINCATCH-1389] Support base64 upload (#176) * Fix sending data from browser as data-uri * Accept base64 type for uploads * Remove base64/ * Move Id generation to client (#177) * Remove id generation from server * Move file after upload * Remove extra debugger call * README for filestorage module (#178) * Add initial readme content * Add more jsdocs * Ignore vscode extra config * Add Readme and JSDocs to the filestore-client (#179) * Add jsdocs * add readme * Update to master (#182) * Fix types error for api-controller and demoDataSetup (#169) * fix types error for api-controller and demoDataSetup * handle undefined connectionPromise * Fix compilation error * Pre release (#183) * Add public access to package.json for new packages * Pre-release publishing * [RAINCATCH-1388] Filestore tests (#180) * Start refactoring for tests * Add some tests for filestore * Add tests for writeStreamToFile * Finish tests for fileService * Lower coverage reqs * Rename storage class to match filename * Add string type for createTemporaryStorageFolder * Add first tests for gridfs storage * Add tests for gridfs * Update jsdocs * Update package version to pre-release one * update dependencies to match hoisted versions * Fix hanging test * [RAINCATCH-1386][WIP] Add unit tests for FileStore Client (#181) * add tests for fileQueue * add fileManager tests * [RAINCATCH 1387] Tests for Camera (#184) * Add tests for buildCameraOptions * Add some mocks * Update versions to match hoisted * Add tests for capture() * Fix linting and remove coverage check on unfinished tests * Fix file queue tests * Update dependencies * Add snyk exception to s3 * Add generics to promisify call to avoid compilation errors * Fix promisify * Change version of filestore
Motivation
Add unit testing for the server-side file storage module and implementations
Progress