-
Notifications
You must be signed in to change notification settings - Fork 938
Add comprehensive tests for Unlock feature #6426
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
|
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6426 +/- ##
==========================================
+ Coverage 86.05% 86.30% +0.24%
==========================================
Files 777 780 +3
Lines 56245 56374 +129
Branches 8140 8140
==========================================
+ Hits 48400 48651 +251
+ Misses 5011 4884 -127
- Partials 2834 2839 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Claude finished @SaintPatrck's task in 2m 19s —— View job Code Review SummaryStatus: Approved PR OverviewThis PR adds comprehensive test coverage for the Unlock feature, a security-critical authentication flow in the Authenticator application.
Review AssessmentAll previous review comments have been addressed:
Code Quality:
No issues identified - The test code is well-structured and follows project conventions. VerdictReady for merge. |
authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/auth/unlock/UnlockScreenTest.kt
Outdated
Show resolved
Hide resolved
authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/auth/unlock/UnlockViewModelTest.kt
Outdated
Show resolved
Hide resolved
authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/auth/unlock/UnlockViewModelTest.kt
Outdated
Show resolved
Hide resolved
authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/auth/unlock/UnlockScreenTest.kt
Outdated
Show resolved
Hide resolved
authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/auth/unlock/UnlockScreenTest.kt
Show resolved
Hide resolved
Creates complete test coverage for: - UnlockViewModel (17 tests) - UnlockScreen (13 tests) Tests cover biometric unlock flow, error handling, state management, UI interactions, and navigation. Critical for security-critical authentication flow. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Updated 8 test methods to assert against complete UnlockState objects instead of individual field assertions. This follows best practices for state-based testing and makes assertions more explicit and maintainable. Changed tests: - BiometricsUnlockClick with null cipher should update state - BiometricDecodingError should clear biometrics - InvalidStateError should show error dialog - BiometricsLockout should show error dialog - DismissDialog should clear dialog state - StateFlow changes should save to SavedStateHandle - ReceiveVaultUnlockResult with BiometricDecodingError should update state - ReceiveVaultUnlockResult with InvalidStateError should show error All tests pass successfully (17/17). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add assertNotNull import and replace assertTrue with assertNotNull for clearer null-checking semantics. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1717329 to
c3b18e3
Compare
authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/auth/unlock/UnlockViewModelTest.kt
Outdated
Show resolved
Hide resolved
authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/auth/unlock/UnlockViewModelTest.kt
Outdated
Show resolved
Hide resolved
authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/auth/unlock/UnlockScreenTest.kt
Outdated
Show resolved
Hide resolved
Removed unnecessary initialization of onUnlockedCalled in setUp.

🎟️ Tracking
Test coverage improvements for critical unlock/authentication functionality.
📔 Objective
This PR adds comprehensive test coverage for the Unlock feature, which serves as the authentication gate for the Authenticator application. The unlock flow is security-critical and requires thorough testing to ensure correct behavior across all user scenarios.
Test Coverage:
Critical Scenarios Tested:
The unlock screen is the first security barrier users encounter. These tests ensure authentication mechanisms function correctly, handle failures gracefully, and maintain proper security posture across all scenarios.
📸 Screenshots
N/A - Test-only changes
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes🤖 Generated with Claude Code