File tree 2 files changed +38
-0
lines changed
integration-tests/basic-contract-caller 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ use super :: basic_contract_caller:: * ;
2
+ use ink_e2e:: ContractsBackend ;
3
+
4
+ type E2EResult < T > = std:: result:: Result < T , Box < dyn std:: error:: Error > > ;
5
+
6
+ #[ ink_e2e:: test]
7
+ async fn flip_and_get < Client : E2EBackend > ( mut client : Client ) -> E2EResult < ( ) > {
8
+ // given
9
+ let other_contract_code = client
10
+ . upload ( "other-contract" , & ink_e2e:: alice ( ) )
11
+ . submit ( )
12
+ . await
13
+ . expect ( "other_contract upload failed" ) ;
14
+
15
+ let mut constructor = BasicContractCallerRef :: new ( other_contract_code. code_hash ) ;
16
+ let contract = client
17
+ . instantiate ( "basic-contract-caller" , & ink_e2e:: alice ( ) , & mut constructor)
18
+ . submit ( )
19
+ . await
20
+ . expect ( "basic-contract-caller instantiate failed" ) ;
21
+ let mut call_builder = contract. call_builder :: < BasicContractCaller > ( ) ;
22
+ let call = call_builder. flip_and_get ( ) ;
23
+
24
+ // when
25
+ let result = client
26
+ . call ( & ink_e2e:: alice ( ) , & call)
27
+ . submit ( )
28
+ . await
29
+ . expect ( "Calling `flip_and_get` failed" )
30
+ . return_value ( ) ;
31
+
32
+ assert_eq ! ( result, false ) ;
33
+
34
+ Ok ( ( ) )
35
+ }
Original file line number Diff line number Diff line change @@ -39,3 +39,6 @@ mod basic_contract_caller {
39
39
}
40
40
}
41
41
}
42
+
43
+ #[ cfg( all( test, feature = "e2e-tests" ) ) ]
44
+ mod e2e_tests;
You can’t perform that action at this time.
0 commit comments