From ffd586ec46111bd79c076a24b8fab6048c749857 Mon Sep 17 00:00:00 2001 From: kutluhaneth46 Date: Sun, 27 Sep 2026 20:38:22 +0000 Subject: [PATCH] test(evm-node): cover rpc_get_version field population Closes: #447 Assert non-empty version fields and short-hash/commit consistency. --- crates/evm-node/src/rpc/get_version.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/crates/evm-node/src/rpc/get_version.rs b/crates/evm-node/src/rpc/get_version.rs index afc6bc5f..33351920 100644 --- a/crates/evm-node/src/rpc/get_version.rs +++ b/crates/evm-node/src/rpc/get_version.rs @@ -41,3 +41,26 @@ pub fn rpc_get_version() -> RpcResult { cargo_version: arc_version::SHORT_VERSION.to_string(), }) } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn rpc_get_version_returns_populated_fields() { + let info = rpc_get_version().expect("version info"); + assert!(!info.git_version.is_empty(), "git_version"); + assert!(!info.git_commit.is_empty(), "git_commit"); + assert!(!info.git_short_hash.is_empty(), "git_short_hash"); + assert!(!info.cargo_version.is_empty(), "cargo_version"); + assert!( + info.git_commit.starts_with(&info.git_short_hash), + "git_short_hash should be a prefix of git_commit" + ); + assert!( + info.cargo_version.contains(&info.git_short_hash) + || info.cargo_version.contains(&info.git_version), + "cargo_version should reference a git identifier" + ); + } +}