From 7b09c887250d79c63f52c33740776c0a21206d90 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Wed, 31 May 2023 16:33:15 +0200 Subject: [PATCH] Fix all denoms metadata mock --- packages/std/src/testing/mock.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/std/src/testing/mock.rs b/packages/std/src/testing/mock.rs index 14ab622999..66ef04c68b 100644 --- a/packages/std/src/testing/mock.rs +++ b/packages/std/src/testing/mock.rs @@ -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 }; @@ -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 {