mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-22 05:35:42 +00:00
fix(tests): don't assume order of balance transfer extrinsics (#1655)
* fix(tests): don't assert order of balanace ext * move timestamp to loop
This commit is contained in:
@@ -226,23 +226,39 @@ async fn fetch_block_and_decode_extrinsic_details() {
|
|||||||
.map(|res| res.unwrap())
|
.map(|res| res.unwrap())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
// All blocks contain a timestamp; check this first:
|
let mut balance = None;
|
||||||
let timestamp = block_extrinsics.first().unwrap();
|
let mut timestamp = None;
|
||||||
timestamp.as_root_extrinsic::<node_runtime::Call>().unwrap();
|
|
||||||
timestamp
|
|
||||||
.as_extrinsic::<node_runtime::timestamp::calls::types::Set>()
|
|
||||||
.unwrap();
|
|
||||||
assert!(!timestamp.is_signed());
|
|
||||||
|
|
||||||
// Next we expect our transfer:
|
for tx in block_extrinsics {
|
||||||
let tx = block_extrinsics.get(1).unwrap();
|
tx.as_root_extrinsic::<node_runtime::Call>().unwrap();
|
||||||
tx.as_root_extrinsic::<node_runtime::Call>().unwrap();
|
|
||||||
let ext = tx
|
if let Some(ext) = tx
|
||||||
.as_extrinsic::<node_runtime::balances::calls::types::TransferAllowDeath>()
|
.as_extrinsic::<node_runtime::timestamp::calls::types::Set>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap();
|
{
|
||||||
assert_eq!(ext.value, 10_000);
|
timestamp = Some((ext, tx.is_signed()));
|
||||||
assert!(tx.is_signed());
|
}
|
||||||
|
|
||||||
|
if let Some(ext) = tx
|
||||||
|
.as_extrinsic::<node_runtime::balances::calls::types::TransferAllowDeath>()
|
||||||
|
.unwrap()
|
||||||
|
{
|
||||||
|
balance = Some((ext, tx.is_signed()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that we found the timestamp
|
||||||
|
{
|
||||||
|
let (_, is_signed) = timestamp.expect("Timestamp not found");
|
||||||
|
assert!(!is_signed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that we found the balance transfer
|
||||||
|
{
|
||||||
|
let (tx, is_signed) = balance.expect("Balance transfer not found");
|
||||||
|
assert_eq!(tx.value, 10_000);
|
||||||
|
assert!(is_signed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(fullclient)]
|
#[cfg(fullclient)]
|
||||||
|
|||||||
Reference in New Issue
Block a user