-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Remove
basic_contract_caller
integration test, moved to #1909"
This reverts commit 8f3ab31.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use super::basic_contract_caller::*; | ||
use ink_e2e::ContractsBackend; | ||
|
||
type E2EResult<T> = std::result::Result<T, Box<dyn std::error::Error>>; | ||
|
||
#[ink_e2e::test] | ||
async fn flip_and_get<Client: E2EBackend>( | ||
mut client: Client, | ||
) -> E2EResult<()> { | ||
// given | ||
let other_contract_code = client | ||
.upload("other-contract", &ink_e2e::alice()) | ||
.submit() | ||
.await | ||
.expect("other_contract upload failed"); | ||
|
||
let mut constructor = BasicContractCallerRef::new(other_contract_code.code_hash); | ||
let contract = client | ||
.instantiate("basic-contract-caller", &ink_e2e::alice(), &mut constructor) | ||
.submit() | ||
.await | ||
.expect("basic-contract-caller instantiate failed"); | ||
let mut call_builder = contract.call_builder::<BasicContractCaller>(); | ||
let call = call_builder.flip_and_get(); | ||
|
||
// when | ||
let result = client | ||
.call( | ||
&ink_e2e::alice(), | ||
&call, | ||
) | ||
.submit() | ||
.await | ||
.expect("Calling `flip_and_get` failed") | ||
.return_value(); | ||
|
||
assert_eq!(result, false); | ||
|
||
Ok(()) | ||
} |
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 |
---|---|---|
|
@@ -39,3 +39,6 @@ mod basic_contract_caller { | |
} | ||
} | ||
} | ||
|
||
#[cfg(all(test, feature = "e2e-tests"))] | ||
mod e2e_tests; |