Skip to content

Commit

Permalink
fix(derive-alloy): test coverage (#785)
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell authored Nov 5, 2024
1 parent 18d28f1 commit 71e35a7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ ignore:
- "**/test_utils*"
- "**/test_util*"
- "**/tests*"
- "crates/derive-alloy/src/alloy_providers.rs"
- "crates/derive-alloy/src/beacon_client.rs"
- "crates/mpt/src/noop.rs"

# Make comments less noisy
Expand Down
24 changes: 24 additions & 0 deletions crates/derive-alloy/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,27 @@ impl From<AlloyProviderError> for PipelineErrorKind {
}
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_from_alloy_provider_error() {
let err: PipelineErrorKind = AlloyProviderError::Rlp(alloy_rlp::Error::Overflow).into();
assert!(matches!(err, PipelineErrorKind::Critical(_)));

let err: PipelineErrorKind =
AlloyProviderError::BlockInfo(FromBlockError::InvalidGenesisHash).into();
assert!(matches!(err, PipelineErrorKind::Critical(_)));

let err: PipelineErrorKind = AlloyProviderError::OpBlockConversion(
OpBlockConversionError::MissingSystemConfigGenesis,
)
.into();
assert!(matches!(err, PipelineErrorKind::Critical(_)));

let err: PipelineErrorKind = AlloyProviderError::Rpc(RpcError::NullResp).into();
assert!(matches!(err, PipelineErrorKind::Temporary(_)));
}
}

0 comments on commit 71e35a7

Please sign in to comment.