-
Notifications
You must be signed in to change notification settings - Fork 8
feat: mock password variable update #55
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
WalkthroughThis PR refactors wallet test files to introduce centralized password constants (mockedPassword and mockedInvalidPassword) and replace hard-coded password strings throughout the test suite, improving test maintainability without altering test logic or behavior. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/implementations/wallet/__tests__/encrypt.test.ts (1)
23-23: LGTM! Comprehensive usage across encryption tests.The constant is correctly used in both prompt mocks (lines 23, 31) and the decryption verification (line 58), ensuring consistency throughout the encryption test suite.
Consider consolidating test password constants into a shared test utilities file (e.g.,
test-utils.ts) to avoid duplication across the six test files. This would provide a single source of truth for test credentials. However, this can be deferred to a future improvement if preferred.Also applies to: 31-31, 58-58
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
src/__tests__/wallet.test.ts(3 hunks)src/implementations/utils/__tests__/wallet-astron.test.ts(3 hunks)src/implementations/utils/__tests__/wallet-astrontestnet.test.ts(3 hunks)src/implementations/utils/__tests__/wallet.test.ts(4 hunks)src/implementations/wallet/__tests__/create.test.ts(3 hunks)src/implementations/wallet/__tests__/encrypt.test.ts(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/implementations/wallet/__tests__/encrypt.test.ts (1)
src/implementations/wallet/encrypt.ts (1)
encrypt(11-34)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Tests / Run Tests
🔇 Additional comments (11)
src/__tests__/wallet.test.ts (2)
12-13: LGTM! Good refactoring to centralize test password.The introduction of
mockedPasswordimproves test maintainability by eliminating magic strings and clearly documenting the test credential.
35-35: LGTM! Consistent usage of the password constant.The replacement of hard-coded password strings with
mockedPasswordmakes the tests more maintainable and easier to update if needed.Also applies to: 65-65
src/implementations/utils/__tests__/wallet-astron.test.ts (2)
14-16: LGTM! Well-structured test constants.The introduction of both
mockedPasswordandmockedInvalidPasswordappropriately covers both success and failure test scenarios.
55-55: LGTM! Proper usage of password constants.The constants are correctly applied in both the successful decryption and invalid password error test cases.
Also applies to: 66-66
src/implementations/wallet/__tests__/create.test.ts (2)
8-9: LGTM! Clear and well-documented test constant.The
mockedPasswordconstant with explanatory comment improves test clarity and maintainability.
23-23: LGTM! Consistent password usage across test flow.The constant is properly used in both the prompt mock (line 23) and the wallet decryption assertion (line 50), ensuring consistency throughout the test.
Also applies to: 50-50
src/implementations/utils/__tests__/wallet.test.ts (2)
22-24: LGTM! Comprehensive test password constants.The introduction of both password constants is well-placed and documented, supporting multiple test scenarios throughout the file.
96-96: LGTM! Consistent application across all encrypted wallet tests.The password constants are correctly used across multiple test cases (lines 96, 107, 179), improving maintainability without altering test behavior.
Also applies to: 107-107, 179-179
src/implementations/utils/__tests__/wallet-astrontestnet.test.ts (2)
14-16: LGTM! Consistent test constants pattern.The password constants match the pattern used in
wallet-astron.test.ts, maintaining consistency across similar test files.
58-58: LGTM! Proper usage in both test scenarios.The constants are correctly applied in the encrypted wallet success test (line 58) and the invalid password error test (line 69).
Also applies to: 69-69
src/implementations/wallet/__tests__/encrypt.test.ts (1)
12-13: LGTM! Well-documented test constant.The
mockedPasswordconstant with clear comment improves test maintainability.
|
🎉 This PR is included in version 3.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
update variable name to reflect used mocked password
Summary by CodeRabbit