Skip to content

Conversation

@Moiz47
Copy link

@Moiz47 Moiz47 commented Nov 6, 2025

Summary

update variable name to reflect used mocked password

Summary by CodeRabbit

  • Tests
    • Centralized test password constants across wallet test suites to improve code maintainability and consistency.

@coderabbitai
Copy link

coderabbitai bot commented Nov 6, 2025

Walkthrough

This 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

Cohort / File(s) Summary
Root-level wallet tests
src/__tests__/wallet.test.ts
Introduces mockedPassword constant and replaces hard-coded "password123" prompt responses in test setup
Utils wallet tests
src/implementations/utils/__tests__/wallet-astron.test.ts, src/implementations/utils/__tests__/wallet-astrontestnet.test.ts, src/implementations/utils/__tests__/wallet.test.ts
Introduces mockedPassword and mockedInvalidPassword constants; replaces inline password strings in encrypted-wallet and invalid-password test cases
Wallet implementation tests
src/implementations/wallet/__tests__/create.test.ts, src/implementations/wallet/__tests__/encrypt.test.ts
Replaces existing password variables and hard-coded strings with new mockedPassword constant throughout prompt mocking and wallet decryption flows

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Homogeneous refactoring pattern applied consistently across six test files
  • No functional logic changes or control flow modifications
  • Primary concern: verify constant values are correct and all usages are properly replaced

Poem

🐰 Hop hop, the tests now shine so bright,
Constants gathered, passwords tight,
No more strings scattered far and wide,
Testing cleaner, centralized pride! 🐇

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete; it lacks the 'Changes' and 'Issues' sections specified in the template, providing only a partial 'Summary' section. Add a 'Changes' section detailing the modifications (e.g., introduce mockedPassword constants, replace hard-coded passwords), and an 'Issues' section if applicable.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: mock password variable update' clearly summarizes the main change across multiple test files: introducing and using mockedPassword constants to replace hard-coded password strings.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/rename-mockpassword

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between f70ab2b and 77bdab7.

📒 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 mockedPassword improves 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 mockedPassword makes 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 mockedPassword and mockedInvalidPassword appropriately 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 mockedPassword constant 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 mockedPassword constant with clear comment improves test maintainability.

@Moiz47 Moiz47 requested a review from rongquan1 November 6, 2025 11:52
@rongquan1 rongquan1 merged commit 8e68688 into master Nov 7, 2025
10 checks passed
@rongquan1 rongquan1 deleted the feat/rename-mockpassword branch November 7, 2025 10:29
@github-actions
Copy link

github-actions bot commented Nov 7, 2025

🎉 This PR is included in version 3.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants