Skip to content

Commit

Permalink
test: add test for pk parsing (foundry-rs#8366)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jul 5, 2024
1 parent 642f13f commit 7cb51ec
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/wallets/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,17 @@ pub fn create_keystore_signer(
Ok((None, Some(PendingSigner::Keystore(path.clone()))))
}
}

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

#[test]
fn parse_private_key_signer() {
let pk = B256::random();
let pk_str = pk.to_string();
assert!(create_private_key_signer(&pk_str).is_ok());
// skip 0x
assert!(create_private_key_signer(&pk_str[2..]).is_ok());
}
}

0 comments on commit 7cb51ec

Please sign in to comment.