Skip to content

QA-BitVMX: Added tests to cover protocol configuration#83

Open
andrelo86 wants to merge 4 commits intodevfrom
qa_test_config
Open

QA-BitVMX: Added tests to cover protocol configuration#83
andrelo86 wants to merge 4 commits intodevfrom
qa_test_config

Conversation

@andrelo86
Copy link
Collaborator

@andrelo86 andrelo86 commented Mar 9, 2026

Add config loading test coverage

Introduces config_test.rs with 4 tests covering Config::new():

  1. Load development config — BITVMX_ENV=development parses successfully and validates builder.ecdsa_sighash_type and rpc.network
  2. Default env fallback — unset BITVMX_ENV falls back to development correctly
  3. Unknown env returns error — nonexistent environment returns ConfigError::ConfigFileError
  4. All development fields — exhaustive validation of every readable field in development.json
  • A static Mutex serializes env-var mutation across tests to prevent race conditions in parallel test runs.

  • _guard explanation
    Here guard is held intentionally for its Drop side effect.
    _guard is the established Rust idiom for this exact pattern — its documented in The Rust Reference as suppress the warning for a binding kept alive for its destructor.

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.

1 participant