Skip to content

Commit

Permalink
fix(interchain-token-service): non deterministic test (#620)
Browse files Browse the repository at this point in the history
  • Loading branch information
haiyizxx authored Sep 11, 2024
1 parent 2d4a99c commit 52fff84
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
12 changes: 11 additions & 1 deletion interchain-token-service/tests/instantiate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn instantiate_with_args_succeeds() {
.into_iter()
.collect::<HashMap<_, _>>();

let response = assert_ok!(contract::instantiate(
let mut response = assert_ok!(contract::instantiate(
deps.as_mut(),
mock_env(),
mock_info("sender", &[]),
Expand All @@ -40,6 +40,16 @@ fn instantiate_with_args_succeeds() {
its_contracts: its_contracts.clone(),
},
));

response.events.sort_by_key(|event| {
event
.attributes
.iter()
.find(|attr| attr.key == "chain")
.map(|attr| attr.value.clone())
.unwrap_or_default()
});

assert_eq!(0, response.messages.len());
goldie::assert_json!(response);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"attributes": [
{
"key": "chain",
"value": "optimism"
"value": "ethereum"
},
{
"key": "address",
"value": "op-address"
"value": "eth-address"
}
]
},
Expand All @@ -20,11 +20,11 @@
"attributes": [
{
"key": "chain",
"value": "ethereum"
"value": "optimism"
},
{
"key": "address",
"value": "eth-address"
"value": "op-address"
}
]
}
Expand Down

0 comments on commit 52fff84

Please sign in to comment.