Skip to content

Commit

Permalink
attempt to fix unspecified test
Browse files Browse the repository at this point in the history
  • Loading branch information
harrysolovay committed Oct 1, 2024
1 parent eb5c441 commit 659104f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions src/api/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@ impl MinaMesh {

// TODO: use default token value, check how to best handle this
pub async fn user_commands(&self, metadata: &BlockMetadata) -> Result<Vec<Transaction>, MinaMeshError> {
Ok(
sqlx::query_file_as!(
UserCommandMetadata,
"sql/user_commands.sql",
metadata.id,
// cspell:disable-next-line
"wSHV2S4qX9jFsLjQo8r1BsMLH2ZRKsZx6EJd1sbozGPieEC4Jf"
)
.fetch_all(&self.pg_pool)
.await?
let metadata = sqlx::query_file_as!(
UserCommandMetadata,
"sql/user_commands.sql",
metadata.id,
// cspell:disable-next-line
"wSHV2S4qX9jFsLjQo8r1BsMLH2ZRKsZx6EJd1sbozGPieEC4Jf"
)
.fetch_all(&self.pg_pool)
.await?;
let transactions = metadata
.into_iter()
.map(|item| Transaction::new(TransactionIdentifier::new(item.hash.clone()), Wrapper(&item).into()))
.collect(),
)
.collect();
Ok(transactions)
}

pub async fn block_metadata(
Expand Down
4 changes: 2 additions & 2 deletions tests/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::OnceLock;
use anyhow::Result;
use futures::{stream::FuturesUnordered, StreamExt};
use mina_mesh::{
BlockMetadata, BlockRequest, MinaMeshConfig, MinaMeshError, NetworkIdentifier, PartialBlockIdentifier,
BlockRequest, BlockResponse, MinaMeshConfig, MinaMeshError, NetworkIdentifier, PartialBlockIdentifier,
};

#[tokio::test]
Expand All @@ -13,7 +13,7 @@ async fn specified() -> Result<()> {
.iter()
.map(|item| mina_mesh.block(BlockRequest::new(network_identifier().to_owned(), item.to_owned())))
.collect::<FuturesUnordered<_>>();
let mut maybe_prev: Option<Result<BlockMetadata, MinaMeshError>> = None;
let mut maybe_prev: Option<Result<BlockResponse, MinaMeshError>> = None;
while let Some(resolved) = metadata_futures.next().await {
if let Some(prev) = maybe_prev {
assert_eq!(prev, resolved);
Expand Down

0 comments on commit 659104f

Please sign in to comment.