Skip to content

Add copy file endpoint code#37

Open
sathuhebbar wants to merge 4 commits intoXkonti:mainfrom
sathuhebbar:copy-file
Open

Add copy file endpoint code#37
sathuhebbar wants to merge 4 commits intoXkonti:mainfrom
sathuhebbar:copy-file

Conversation

@sathuhebbar
Copy link

Added file src/endpoints/file.copyFile.ts, modified src/app.ts:

  1. Addresses Copy a file #26
  2. Tests have not yet been implemented
  3. Error messages and handling are still rudimentary, will work on them

Copy link
Owner

@Xkonti Xkonti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice so far!

@sathuhebbar
Copy link
Author

sathuhebbar commented Oct 8, 2023

Added these changes, additionally modified src/constants/commonResponses.ts to add constants for the new error messages.
Please have a look.

@sathuhebbar
Copy link
Author

Made the required modifications. Can you please tell me about this failing workflow test? I don't really understand what it means.

Thanks!

@Xkonti
Copy link
Owner

Xkonti commented Oct 9, 2023

If you click on details next to the failed Test PR / check-pr (pull_request) workflow it will display the the log. There at the end you can see that all tests have passed. And right before that you have a table showing the test coverage:

---------------------------------------|---------|---------|-------------------

File % Funcs % Lines Uncovered Line #s
All files 96.11 88.48
src/app.ts 100.00 100.00
src/constants/commonResponses.ts 100.00 100.00
src/endpoints/errors.ts 100.00 100.00
src/endpoints/file/checkFileExists.ts 100.00 92.00 29-30
src/endpoints/file/copyFile.ts 50.00 ⚠️ 8.93 ⚠️ 13-63
src/endpoints/file/getFile.ts 100.00 91.67 28-29
src/endpoints/file/getFileSize.ts 100.00 91.67 29-30
src/endpoints/file/uploadFile.ts 100.00 77.98 67,70-79,81-82,122,125-127,129-130,144,153-154,158
src/endpoints/guards.ts 100.00 100.00
src/endpoints/list/getList.ts 100.00 86.67 28,30-31
src/testing/constants.ts 100.00 100.00
src/testing/testFileSystem.ts 100.00 94.74 24-26
src/utils/config.ts 100.00 100.00
src/utils/directoryUtils.ts 100.00 95.06 23,71,88
src/utils/fileUtils.ts 80.00 53.97 ⚠️ 55,63,80-106
src/utils/pathUtils.ts 100.00 100.00
src/utils/requestBuilder.ts 100.00 100.00
src/utils/urlBuilder.ts 100.00 100.00
--------------------------------------- --------- --------- -------------------

The project is configured to fail pull requests if any of the files' test coverage is below 70% of functions or lines:

file-api/bunfig.toml

Lines 1 to 3 in bd3b6fb

[test]
coverage = true
coverageThreshold = 0.7

In the table I highlighted both copyFile.ts and fileUtils.ts that don't have enough test coverage.

You can look at uploadFile.ts and getFile.ts endpoints to see how they are tested (different edge cases etc) and then how other methods if fileUtils.ts are tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants