-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chain sim - adder interactor integration test
- Loading branch information
1 parent
dc2f0f8
commit a35096d
Showing
6 changed files
with
80 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pub mod basic_interact_cli; | ||
pub mod basic_interact_config; | ||
pub mod basic_interact_state; | ||
pub mod basic_interact; | ||
|
||
pub use basic_interact::{AdderInteract, adder_cli}; | ||
pub use basic_interact_config::Config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
extern crate basic_interact; | ||
|
||
#[tokio::main] | ||
pub async fn main() { | ||
basic_interact::adder_cli().await; | ||
} |
30 changes: 30 additions & 0 deletions
30
contracts/examples/adder/interact/tests/basic_interact_cs_test.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use basic_interact::{AdderInteract, Config}; | ||
|
||
#[tokio::test] | ||
#[cfg_attr(not(feature = "chain_simulator"), ignore)] | ||
async fn simulator_upgrade_test() { | ||
let mut basic_interact = AdderInteract::init(Config::chain_simulator_config()).await; | ||
// let wallet_address = basic_interact.wallet_address.clone(); | ||
let adder_owner_address = basic_interact.adder_owner_address.clone(); | ||
// let error_not_owner = (4, "upgrade is allowed only for owner"); | ||
|
||
basic_interact.deploy().await; | ||
basic_interact.add(1u32).await; | ||
|
||
// Sum will be 1 | ||
basic_interact.print_sum().await; | ||
|
||
basic_interact | ||
.upgrade(7u32, &adder_owner_address, None) | ||
.await; | ||
|
||
// Sum will be the updated value of 7 | ||
basic_interact.print_sum().await; | ||
|
||
// basic_interact | ||
// .upgrade(10u32, &wallet_address, Some(error_not_owner)) | ||
// .await; | ||
|
||
// // Sum will remain 7 | ||
// basic_interact.print_sum().await; | ||
} |