-
Notifications
You must be signed in to change notification settings - Fork 932
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
base: main
Are you sure you want to change the base?
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 85.78% 86.02% +0.24%
==========================================
Files 776 776
Lines 56201 56201
Branches 8117 8117
==========================================
+ Hits 48211 48346 +135
+ Misses 5166 5026 -140
- Partials 2824 2829 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Claude finished @SaintPatrck's task in 2m 36s —— View job Code Review Complete
SummaryThis PR adds comprehensive test coverage for the Unlock feature with 672 lines of well-structured tests across two files. The tests cover both ViewModel business logic and Compose UI interactions. Previous Review Comments Status
FindingsOne open thread remains at Positive aspects:
No new issues identified - The code follows established patterns and Bitwarden testing conventions. VerdictThe tests are well-structured and all previously raised review comments have been addressed except for the open thread about dialog assertions. Ready for merge once that discussion is 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/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

🎟️ 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