diff --git a/crates/pop-cli/src/commands/up/contract.rs b/crates/pop-cli/src/commands/up/contract.rs index 5f7693bc..497a01c0 100644 --- a/crates/pop-cli/src/commands/up/contract.rs +++ b/crates/pop-cli/src/commands/up/contract.rs @@ -478,10 +478,20 @@ mod tests { } #[tokio::test] - async fn get_upload_call_data_works() -> anyhow::Result<()> { + async fn get_upload_and_instantiate_call_data_works() -> anyhow::Result<()> { let (contracts_node_process, port, temp_dir) = start_test_environment().await?; let localhost_url = format!("ws://127.0.0.1:{}", port); - sleep(Duration::from_secs(20)).await; + sleep(Duration::from_secs(5)).await; + + get_upload_call_data_works(port, temp_dir).await?; + + // Stop running contracts-node + stop_test_environment(&contracts_node_process.id().to_string())?; + Ok(()) + } + + async fn get_upload_call_data_works(port: u16, temp_dir: TempDir) -> anyhow::Result<()> { + let localhost_url = format!("ws://127.0.0.1:{}", port); let up_contract_opts = UpContractCommand { path: Some(temp_dir.path().join("testing")), @@ -528,17 +538,11 @@ mod tests { // Retrieved call data and calculated match. assert_eq!(retrieved_call_data, encoded_expected_call_data); - - // Stop running contracts-node - stop_test_environment(&contracts_node_process.id().to_string())?; Ok(()) } - #[tokio::test] - async fn get_instantiate_call_data_works() -> anyhow::Result<()> { - let (contracts_node_process, port, temp_dir) = start_test_environment().await?; + async fn get_instantiate_call_data_works(port: u16, temp_dir: TempDir) -> anyhow::Result<()> { let localhost_url = format!("ws://127.0.0.1:{}", port); - sleep(Duration::from_secs(20)).await; let up_contract_opts = UpContractCommand { path: Some(temp_dir.path().join("testing")), @@ -575,8 +579,6 @@ mod tests { // Retrieved call data matches the one crafted above. assert_eq!(retrieved_call_data, expected_call_data); - // Stop running contracts-node - stop_test_environment(&contracts_node_process.id().to_string())?; Ok(()) } }