Skip to content

Commit

Permalink
Prettify test output when encoding doesn't match (paritytech#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
HCastano authored and serban300 committed Apr 8, 2024
1 parent 45b62f0 commit bb7bb1d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bridges/relays/bin-substrate/src/chains/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ mod rococo_tests {
extrinsics_root: Default::default(),
digest: sp_runtime::generic::Digest { logs: vec![] },
};

let justification = GrandpaJustification {
round: 0,
commit: finality_grandpa::Commit {
Expand All @@ -268,6 +269,7 @@ mod rococo_tests {
},
votes_ancestries: vec![],
};

let actual = bp_rococo::BridgeGrandpaWestendCall::submit_finality_proof(header.clone(), justification.clone());
let expected = millau_runtime::BridgeGrandpaRialtoCall::<millau_runtime::Runtime>::submit_finality_proof(
header,
Expand All @@ -281,7 +283,7 @@ mod rococo_tests {
// then
assert_eq!(
actual_encoded, expected_encoded,
"Encoding difference. Raw: {:?} vs {:?}",
"\n\nEncoding difference.\nGot {:#?} \nExpected: {:#?}",
actual, expected
);
}
Expand All @@ -302,6 +304,7 @@ mod westend_tests {
extrinsics_root: Default::default(),
digest: sp_runtime::generic::Digest { logs: vec![] },
};

let justification = GrandpaJustification {
round: 0,
commit: finality_grandpa::Commit {
Expand All @@ -311,6 +314,7 @@ mod westend_tests {
},
votes_ancestries: vec![],
};

let actual = bp_westend::BridgeGrandpaRococoCall::submit_finality_proof(header.clone(), justification.clone());
let expected = millau_runtime::BridgeGrandpaRialtoCall::<millau_runtime::Runtime>::submit_finality_proof(
header,
Expand All @@ -324,7 +328,7 @@ mod westend_tests {
// then
assert_eq!(
actual_encoded, expected_encoded,
"Encoding difference. Raw: {:?} vs {:?}",
"\n\nEncoding difference.\nGot {:#?} \nExpected: {:#?}",
actual, expected
);
}
Expand Down

0 comments on commit bb7bb1d

Please sign in to comment.