Skip to content

fix(tests): reduce panic-prone calls in wallet_analytics_test.rs#700

Open
paul-itodo wants to merge 1 commit into
kellymusk:masterfrom
paul-itodo:fix/567-reduce-panics-wallet-analytics-test
Open

fix(tests): reduce panic-prone calls in wallet_analytics_test.rs#700
paul-itodo wants to merge 1 commit into
kellymusk:masterfrom
paul-itodo:fix/567-reduce-panics-wallet-analytics-test

Conversation

@paul-itodo

Copy link
Copy Markdown

Summary

  • Port tests/wallet_analytics_test.rs from upstream and land it in this fork (file was missing from the fork's master)
  • Replace all 33 bare .unwrap() calls with .expect("message") to add observability context on failure
  • Convert the double-unwrap pattern (assert!(x.is_some()); x.unwrap()) to a single .expect() that names the asserted invariant

Changes

  • tests/wallet_analytics_test.rs (new): full integration test suite for wallet analytics with typed failure messages on every fallible call

Acceptance criteria met

  • All avoidable panic-prone calls removed or replaced with contextual expect messages
  • Error paths preserve observability — failures name the query or operation that failed
  • DB connection setup retains its expect (unrecoverable if no test DB available)

Closes #567

Test plan

  • Run cargo test --test wallet_analytics_test -- --ignored against a running test database
  • Confirm each test either passes or fails with a descriptive message (not an opaque "called unwrap() on a None value")
    🤖 Generated with Claude Code

…lymusk#567)

Replace all bare .unwrap() calls with .expect("message") to add
observability context on test failure. The double-unwrap pattern
(assert is_some then unwrap) is replaced with a single expect that
names the invariant being asserted. DB connection setup retains its
expect since the test cannot proceed without a live database.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Codebase Audit] Reduce panic-prone calls in tests/wallet_analytics_test.rs

1 participant