diff --git a/crates/proof-of-sql/src/tests/mod.rs b/crates/proof-of-sql/src/tests/mod.rs index 888f44b5a..595f2d4a0 100644 --- a/crates/proof-of-sql/src/tests/mod.rs +++ b/crates/proof-of-sql/src/tests/mod.rs @@ -1,3 +1,3 @@ -// mod sol_test; +mod sol_test; mod sol_test_util; pub(crate) use sol_test_util::{ForgeScript, ForgeScriptError}; diff --git a/crates/proof-of-sql/src/tests/sol_test.rs b/crates/proof-of-sql/src/tests/sol_test.rs index 312d971f0..1e00ffe2f 100644 --- a/crates/proof-of-sql/src/tests/sol_test.rs +++ b/crates/proof-of-sql/src/tests/sol_test.rs @@ -1,42 +1,39 @@ -use alloy_primitives::{Bytes, U256}; -use alloy_sol_types::{sol, SolValue}; -use forge_script::ScriptArgs; +use crate::tests::{ForgeScript, ForgeScriptError}; +use alloy_sol_types::{private::primitives::U256, sol}; -#[tokio::test(flavor = "multi_thread")] -async fn we_can_run_solidity_script_from_rust() { - ScriptArgs { - path: "./sol_src/tests/TestScript.t.sol".to_string(), - sig: "rustTestWeCanThrowErrorDependingOnParameter".to_string(), - args: vec![U256::from(1234).to_string()], - ..Default::default() - } - .run_script() - .await +#[test] +#[ignore = "Because forge needs to be installed, we are ignoring this test by default. They will still be run from within the ci."] +fn we_can_run_solidity_script_from_rust() { + ForgeScript::new( + "./sol_src/tests/TestScript.t.sol", + "rustTestWeCanThrowErrorDependingOnParameter", + ) + .arg(U256::from(1234)) + .execute() .unwrap(); - assert!(ScriptArgs { - path: "./sol_src/tests/TestScript.t.sol".to_string(), - sig: "rustTestWeCanThrowErrorDependingOnParameter".to_string(), - args: vec![U256::from(0).to_string()], - ..Default::default() - } - .run_script() - .await - .is_err()); + assert!(matches!( + ForgeScript::new( + "./sol_src/tests/TestScript.t.sol", + "rustTestWeCanThrowErrorDependingOnParameter", + ) + .arg(U256::from(0)) + .execute(), + Err(ForgeScriptError::SolidityError { .. }) + )); } -#[tokio::test(flavor = "multi_thread")] -async fn we_can_pass_custom_struct_into_solidity_from_rust() { +#[test] +#[ignore = "Because forge needs to be installed, we are ignoring this test by default. They will still be run from within the ci."] +fn we_can_pass_custom_struct_into_solidity_from_rust() { sol!("./sol_src/tests/TestScript.t.sol"); let arg = TestScript::CustomStruct { value: U256::from(1234), }; - ScriptArgs { - path: "./sol_src/tests/TestScript.t.sol".to_string(), - sig: "rustTestWeCanAcceptCustomStructAsEncodedBytes".to_string(), - args: vec![Bytes::from(arg.abi_encode()).to_string()], - ..Default::default() - } - .run_script() - .await + ForgeScript::new( + "./sol_src/tests/TestScript.t.sol", + "rustTestWeCanAcceptCustomStructAsEncodedBytes", + ) + .arg(arg) + .execute() .unwrap(); }