Skip to content

Commit

Permalink
Add tests for parse_enriched_log failure
Browse files Browse the repository at this point in the history
  • Loading branch information
themicp committed Feb 16, 2024
1 parent 7deb5d9 commit e2508d7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions relayer/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ pub fn parse_enriched_log(
}
_ => Err(eyre!(
"Enriched log variant is not supported block_hash: {:x} tx_hash: {:x} log_index: {}",
enriched_log.log.block_hash.unwrap(),
enriched_log.log.transaction_hash.unwrap(),
enriched_log.log.log_index.unwrap(),
enriched_log.log.block_hash.unwrap_or_default(),
enriched_log.log.transaction_hash.unwrap_or_default(),
enriched_log.log.log_index.unwrap_or_default(),
)),
}
.and_then(|content| enrich_content(&content, log, block_details, delivery_tag))
Expand Down Expand Up @@ -225,6 +225,15 @@ mod tests {
}
}

#[test]
fn test_parse_enriched_log_failure() {
let enriched_log = EnrichedLog::default();
let block_details = create_test_block_details();

let result = parse_enriched_log(&enriched_log, &block_details, 1);
assert!(result.is_err());
}

#[test]
fn test_enrich_content() {
let content = ContentVariant::Message(Message {
Expand Down

0 comments on commit e2508d7

Please sign in to comment.