Skip to content

Commit

Permalink
increase test coverage
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Jun 5, 2024
1 parent ab6a1ec commit e45f707
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions mm2src/coins/tendermint/tendermint_tx_history_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,5 +1005,30 @@ mod tests {
let value =
get_value_from_event_attributes(&encoded_attributes, AMOUNT_TAG_KEY, AMOUNT_TAG_KEY_BASE64).unwrap();
assert_eq!(value, "27162unucl");

let invalid_attributes = vec![
EventAttribute {
key: String::default(),
value: String::default(),
index: true,
},
EventAttribute {
key: "invalid-key".to_owned(),
value: String::default(),
index: true,
},
EventAttribute {
key: "dummy-key".to_owned(),
value: String::default(),
index: true,
},
];

let value = get_value_from_event_attributes(&invalid_attributes, RECIPIENT_TAG_KEY, RECIPIENT_TAG_KEY_BASE64);
assert_eq!(value, None);
let value = get_value_from_event_attributes(&invalid_attributes, SENDER_TAG_KEY, SENDER_TAG_KEY_BASE64);
assert_eq!(value, None);
let value = get_value_from_event_attributes(&invalid_attributes, AMOUNT_TAG_KEY, AMOUNT_TAG_KEY_BASE64);
assert_eq!(value, None);
});
}

0 comments on commit e45f707

Please sign in to comment.