-
Notifications
You must be signed in to change notification settings - Fork 232
Improve coverage in permalinks package #1502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1502 +/- ##
===========================================
+ Coverage 58.39% 58.71% +0.32%
===========================================
Files 1133 1133
Lines 30298 30298
Branches 6214 6214
===========================================
+ Hits 17692 17789 +97
+ Misses 9951 9838 -113
- Partials 2655 2671 +16 ☔ View full report in Codecov by Sentry. |
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.
LGTM!
/** | ||
* Returns true if the app is in debug mode. | ||
*/ | ||
fun isInDebug() = BuildConfig.DEBUG |
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.
This is what I call "API renaming", I used to do quite a good amount of this in another codebase and then started wondering if I really should:
- On one side I like it because it make things more idiomatic.
- On the other it makes the code less readable to new comers (every Android dev knows what
BuildConfig.DEBUG
is but nobody knows whatisInDebug()
so it could potentially do anything).
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.
I just did this because BuildConfig.DEBUG
didn't seem to be accessible in unit tests. Maybe by generating resources it would work?
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.
BuildConfig
generation is optional since AGP8, maybe that's the issue?
But even better question, why do you need BuildConfig in a unit test, what are you trying to do?
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.
No, the BuildConfig
generation is already enabled for that module. As for why I need this, it's because UserId("foo")
will crash in debug mode so we can track invalid ids but will work fine in release mode. Since we have some code that needs to check for invalid ids in release mode in these classes we need to take into account both cases.
Another option would be to remove this check.
Kudos, SonarCloud Quality Gate passed! |
Type of change
io.element.android.libraries.matrix.api.permalink
(it was 9% before).Content
Added some tests to check our handling of permalinks is correct, and also improve coverage.
Motivation and context
Improving reliability, bumping coverage.
Checklist