Test/dedicated getter failures cli parsing config errors - #304
Open
favourawaku wants to merge 4 commits into
Open
Test/dedicated getter failures cli parsing config errors#304favourawaku wants to merge 4 commits into
favourawaku wants to merge 4 commits into
Conversation
…t to attestation-registry (Lafiya-xyz#186)
|
@favourawaku Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Splits two pre-initialization getter failures (
get_admin,get_attester_registry) out ofattestation-registry's combined test into dedicated,isolated tests matching the pattern already established in
attester-registry, and adds the first-ever test coverage for thelafiya-clicrate —argument-parsing unit tests for the
config listsubcommand, and config-loading error-path tests confirming proper error handling.Changes
#185 — Add a dedicated get_admin() failure-path test to attestation-registry
get_admin_before_initialize_failstest added tocontracts/attestation-registry/src/test.rs, mirroringattester-registry'spattern
configuration_getters_before_initialize_failtest left in place (still covers other getters)#186 — Add a dedicated get_attester_registry() failure-path test to attestation-registry
get_attester_registry_before_initialize_failstest added tocontracts/attestation-registry/src/test.rs, same isolated-test pattern#187 — Add first unit tests for lafiya-cli argument parsing
#[cfg(test)]coverage added tocrates/lafiya-cli/src/main.rsconfig list— simplest option with zero required arguments beyond the subcommand name, read-only semantics, and nodependency on network config loading
parse_config_list_succeeds— validates default network (testnet) and command parsingparse_config_list_with_explicit_network_succeeds— validates explicit--networkflag parsingparse_missing_subcommand_fails— validates that missing subcommand produces parse error#188 — Add unit tests for lafiya-cli config-loading error paths
tempfile = "3.10"added tocrates/lafiya-cli/Cargo.toml[dev-dependencies](matching version inlafiya-config)load_networks_from_missing_file_returns_handled_error— confirms missing config file producesConfigError::NotFound(handled error, notpanic)
load_networks_from_malformed_toml_returns_handled_error— confirms malformed TOML producesConfigError::ParseError(handled error, not panic)Finding: Config Error Handling
✅ Both error paths properly handled: Missing files and malformed TOML both produce well-typed, handled errors via
lafiya-config'sConfigErrorenum. The CLI's?operator gracefully converts these toanyhow::Result, ensuring user-friendly error messages and clean exitsrather than panics. No regressions or gaps detected.
Test Plan
cargo test -p attestation-registryto verify both getter-failure tests passcargo test -p lafiya-clito verify all argument-parsing and config-error tests passNotes
Closes #185, Closes #186, Closes #187, Closes #188