From 102b03bd231a83b306b86c92704dab5173dd6ec3 Mon Sep 17 00:00:00 2001 From: Yun Date: Tue, 31 Oct 2023 18:15:19 -0700 Subject: [PATCH] Fix graphql u128 test failing due to uneven str compare (#1129) --- crates/torii/graphql/src/tests/models_test.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/torii/graphql/src/tests/models_test.rs b/crates/torii/graphql/src/tests/models_test.rs index 71c7a5aff8..ac1c27752b 100644 --- a/crates/torii/graphql/src/tests/models_test.rs +++ b/crates/torii/graphql/src/tests/models_test.rs @@ -1,8 +1,11 @@ #[cfg(test)] mod tests { + use std::str::FromStr; + use anyhow::Result; use async_graphql::dynamic::Schema; use serde_json::Value; + use starknet_crypto::FieldElement; use crate::schema::build_schema; use crate::tests::{run_graphql_query, spinup_types_test, Connection, Record}; @@ -187,12 +190,12 @@ mod tests { let records = records_model_query(&schema, "(order: { field: RANDOM_U128, direction: ASC })").await; let connection: Connection = serde_json::from_value(records).unwrap(); - // let first_record = connection.edges.first().unwrap(); - // let last_record = connection.edges.last().unwrap(); + let first_record_felt = + FieldElement::from_str(&connection.edges.first().unwrap().node.random_u128).unwrap(); + let last_record_felt = + FieldElement::from_str(&connection.edges.last().unwrap().node.random_u128).unwrap(); assert_eq!(connection.total_count, 10); - - // TODO(broody): Reenable - // assert!(first_record.node.random_u128 <= last_record.node.random_u128); + assert!(first_record_felt <= last_record_felt); // *** ORDER + WHERE FILTER TESTING ***