Skip to content

Commit

Permalink
Fix all denoms metadata mock
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed May 31, 2023
1 parent 07da9a5 commit 7b09c88
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/std/src/testing/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ impl BankQuerier {
// if we took more than requested, remove the last element (the next key),
// otherwise this is the last batch
let next_key = if metadata.len() > pagination.limit.u64() as usize {
metadata.pop().map(|m| Binary::from(m.name.as_bytes()))
metadata.pop().map(|m| Binary::from(m.symbol.as_bytes()))
} else {
None
};
Expand Down Expand Up @@ -1362,6 +1362,21 @@ mod tests {
assert_eq!(res.metadata.len(), 10);
assert!(res.next_key.is_some());

// querying next 10 should also work
let res2 = bank
.query(&BankQuery::AllDenomMetadata {
pagination: Some(PageRequest {
key: res.next_key,
limit: Uint64::new(10),
reverse: false,
}),
})
.unwrap()
.unwrap();
let res2: AllDenomMetadataResponse = from_binary(&res2).unwrap();
assert_eq!(res2.metadata.len(), 10);
assert_ne!(res.metadata.last(), res2.metadata.first());

// querying all 100 should work
let res = bank
.query(&BankQuery::AllDenomMetadata {
Expand Down

0 comments on commit 7b09c88

Please sign in to comment.