Skip to content

Commit

Permalink
ping pong interactor - one fn test
Browse files Browse the repository at this point in the history
  • Loading branch information
BiancaIalangi committed Oct 24, 2024
1 parent 44b24f1 commit 8adb1fa
Showing 1 changed file with 9 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ use ping_pong_egld_interact::{Config, PingPongEgldInteract};

#[tokio::test]
#[cfg_attr(not(feature = "chain-simulator-tests"), ignore)]
async fn test_ping_unmatched_amount() {
async fn test_ping_pong_egld() {
let mut interact = PingPongEgldInteract::init(Config::chain_simulator_config()).await;

let ping_amount = 1u64;

// test_ping_unmatched_amount
let duration_in_seconds = 5u64;
let opt_activation_timestamp = 2u64;
let max_funds = 100_000u64;
Expand All @@ -23,14 +24,8 @@ async fn test_ping_unmatched_amount() {
interact
.ping(0u64, Some("the payment must match the fixed sum"), None)
.await;
}

#[tokio::test]
#[cfg_attr(not(feature = "chain-simulator-tests"), ignore)]
async fn test_ping_inactive_contracts() {
let mut interact = PingPongEgldInteract::init(Config::chain_simulator_config()).await;

let ping_amount = 1u64;
// test_ping_inactive_contracts
let duration_in_seconds = 5u64;
let opt_activation_timestamp = 2_000_000_000u64;
let max_funds = 100_000u64;
Expand All @@ -47,14 +42,8 @@ async fn test_ping_inactive_contracts() {
interact
.ping(1u64, Some("smart contract not active yet"), None)
.await;
}

#[tokio::test]
#[cfg_attr(not(feature = "chain-simulator-tests"), ignore)]
async fn test_ping_passed_deadline() {
let mut interact = PingPongEgldInteract::init(Config::chain_simulator_config()).await;

let ping_amount = 1u64;
// test_ping_passed_deadline
let duration_in_seconds = 5u64;
let opt_activation_timestamp = 2u64;
let max_funds = 100_000u64;
Expand All @@ -69,15 +58,10 @@ async fn test_ping_passed_deadline() {
.await;

interact.ping(1u64, Some("deadline has passed"), None).await;
}

#[tokio::test]
#[cfg_attr(not(feature = "chain-simulator-tests"), ignore)]
async fn test_ping_max_funds() {
let mut interact = PingPongEgldInteract::init(Config::chain_simulator_config()).await;

// test_ping_max_funds
let ping_amount = 10u64;
let duration_in_seconds = 30u64;
let duration_in_seconds = 30000u64;
let max_funds = 10u64;

interact
Expand All @@ -92,13 +76,8 @@ async fn test_ping_max_funds() {
interact
.ping(10u64, Some("smart contract full"), None)
.await;
}

#[tokio::test]
#[cfg_attr(not(feature = "chain-simulator-tests"), ignore)]
async fn test_ping() {
let mut interact = PingPongEgldInteract::init(Config::chain_simulator_config()).await;

// test ping
let ping_amount = 1u64;
let duration_in_seconds = 20u64;
let max_funds = 100_000u64;
Expand All @@ -122,13 +101,8 @@ async fn test_ping() {
.await;

interact.pong(None, None).await;
}

#[tokio::test]
#[cfg_attr(not(feature = "chain-simulator-tests"), ignore)]
async fn test_pong_all() {
let mut interact = PingPongEgldInteract::init(Config::chain_simulator_config()).await;

// test_pong_all
let ping_amount = 1u64;
let duration_in_seconds = 18u64;
let max_funds = 100_000u64;
Expand Down

0 comments on commit 8adb1fa

Please sign in to comment.