From b56e76d75aca27eba19f673d7669acf6d45dab3c Mon Sep 17 00:00:00 2001 From: Mihai Calin Luca Date: Thu, 4 Jul 2024 22:02:36 +0200 Subject: [PATCH 1/2] small test fix --- dex/interactor/src/dex_interact.rs | 61 +++++++++++++++++------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/dex/interactor/src/dex_interact.rs b/dex/interactor/src/dex_interact.rs index 65bc71b79..237938fe7 100644 --- a/dex/interactor/src/dex_interact.rs +++ b/dex/interactor/src/dex_interact.rs @@ -79,30 +79,37 @@ impl DexInteract { } // Just for demo, still TODO -// #[cfg(test)] -// pub mod integration_tests { -// use crate::{dex_interact_cli::SwapArgs, pair, DexInteract}; - -// #[test] -// fn test_full_farm_scenario() { -// let rt = crate::tokio::runtime::Runtime::new().unwrap(); - -// rt.block_on(async { -// let mut dex_interact = DexInteract::init().await; -// dex_interact.register_wallets(); -// let args = SwapArgs { -// amount: 10_000_000_000_000_000_000u128, -// min_amount: 1_000_000_000_000u128, -// }; -// let result = pair::swap_tokens_fixed_input(&mut dex_interact, &args).await; -// println!("result {:#?}", result); -// // let args =PairArgs { -// // first_payment_amount: 0u128, -// // second_payment_amount: 0u128, -// // first_token_amount_min: 0u128, -// // second_token_amount_min: 0u128, -// // }; -// // dex_interact.full_farm_scenario(&args).await; -// }); -// } -// } +#[cfg(test)] +pub mod integration_tests { + use multiversx_sc_snippets::tokio; + + use crate::{ + dex_interact_cli::{AddArgs, SwapArgs}, + pair, DexInteract, + }; + + #[tokio::test] + async fn test_swap() { + let mut dex_interact = DexInteract::init().await; + dex_interact.register_wallets(); + let args = SwapArgs { + amount: 10_000_000_000_000_000_000u128, + min_amount: 1_000_000_000_000u128, + }; + let result = pair::swap_tokens_fixed_input(&mut dex_interact, &args).await; + println!("result {:#?}", result); + } + + #[tokio::test] + async fn test_full_farm_scenario() { + // initialize interactor + let mut dex_interact = DexInteract::init().await; + // test users + dex_interact.register_wallets(); + // mock arguments + let args = AddArgs::default(); + + // runs a full farm scenario + dex_interact.full_farm_scenario(&args).await; + } +} From 633bc30d1b64beea261b9e6335204088f8bda004 Mon Sep 17 00:00:00 2001 From: Mihai Calin Luca Date: Thu, 4 Jul 2024 22:30:29 +0200 Subject: [PATCH 2/2] ignore integration tests --- dex/interactor/src/dex_interact.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dex/interactor/src/dex_interact.rs b/dex/interactor/src/dex_interact.rs index 237938fe7..eadfe5b40 100644 --- a/dex/interactor/src/dex_interact.rs +++ b/dex/interactor/src/dex_interact.rs @@ -89,6 +89,7 @@ pub mod integration_tests { }; #[tokio::test] + #[ignore = "run on demand"] async fn test_swap() { let mut dex_interact = DexInteract::init().await; dex_interact.register_wallets(); @@ -101,6 +102,7 @@ pub mod integration_tests { } #[tokio::test] + #[ignore = "run on demand"] async fn test_full_farm_scenario() { // initialize interactor let mut dex_interact = DexInteract::init().await;