Refactor: comprehensive unit tests for FileUtils (Deletion, Validation & Storage)#4721
Open
harshsomankar123-tech wants to merge 2 commits intokiwix:mainfrom
Open
Refactor: comprehensive unit tests for FileUtils (Deletion, Validation & Storage)#4721harshsomankar123-tech wants to merge 2 commits intokiwix:mainfrom
harshsomankar123-tech wants to merge 2 commits intokiwix:mainfrom
Conversation
Contributor
|
@harshsomankar123-tech i have recently changed File Utils please view that and add tests accordingly as i have made new features |
Contributor
Author
|
@atharvyadav22 Sure, I’ll update the tests accordingly |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4721 +/- ##
============================================
+ Coverage 60.48% 60.56% +0.08%
+ Complexity 1625 1619 -6
============================================
Files 327 330 +3
Lines 15615 15726 +111
Branches 2146 2162 +16
============================================
+ Hits 9445 9525 +80
- Misses 4731 4734 +3
- Partials 1439 1467 +28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
@MohitMaliFtechiz could you please review this when you get time? Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #4713
Summary
This PR significantly improves the code coverage of
FileUtils.ktby adding comprehensive unit tests for critical file operations, ZIM validation, and storage path resolution. It achieves >90% coverage for the file.Changes
getAllZimPartsto ensure no regression in split-archive detection.deleteZimFileto verify correct removal of.zim,.part, and split chunks (.zimaa, etc.).isValidZimFileandisSplittedZimFileto validate file extensions and types.getStoragePathandgetLocalFilePathByUriusingMockKto mock Android static classes (Environment,Uri,Context).Technical Details
mockkStaticto mock Kotlin extension functions andAndroid.os.Environment.book.zimandbook.zim.partexist).