Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
neriumrevolta committed Feb 14, 2024
1 parent 3fdaaad commit a57a5c1
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/db/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,23 +256,32 @@ pub async fn list_active_indexers(

#[cfg(test)]
mod tests {
use crate::message_types::PublicPoiMessage;

use super::*;
use serde_json::json;


use sqlx::PgPool;




async fn insert_test_data(pool: &PgPool, entries: Vec<(i64, &str)>) {
for (nonce, graph_account) in entries {
let message = json!({
"nonce": nonce,
"graph_account": graph_account
});

sqlx::query!("INSERT INTO messages (message) VALUES ($1)", message)
.execute(pool)
.await
.expect("Failed to insert test data");
let message = PublicPoiMessage {
identifier: "Qm123".to_string(),
content: "text".to_string(),
nonce: nonce.try_into().unwrap(),
network: "text".to_string(),
block_number: 1,
block_hash: "hash".to_string(),
graph_account: graph_account.to_string(),
};

add_message(pool, message).await.expect("Failed to insert test data");
}
}


#[sqlx::test(migrations = "./migrations")]
async fn test_list_active_indexers_without_indexers(pool: PgPool) {
Expand Down

0 comments on commit a57a5c1

Please sign in to comment.