Skip to content

Commit

Permalink
Revert "Remove basic_contract_caller integration test, moved to #1909"
Browse files Browse the repository at this point in the history
This reverts commit 8f3ab31.
  • Loading branch information
ascjones committed Jan 30, 2024
1 parent 8f3ab31 commit af3f9cd
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
40 changes: 40 additions & 0 deletions integration-tests/basic-contract-caller/e2e_tests.rs
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(())
}
3 changes: 3 additions & 0 deletions integration-tests/basic-contract-caller/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ mod basic_contract_caller {
}
}
}

#[cfg(all(test, feature = "e2e-tests"))]
mod e2e_tests;

0 comments on commit af3f9cd

Please sign in to comment.