Hey guys! Sorry for the possibly stupid question
Trying to implement smart contract and decided to make some tests integration to start smart and fast development of the dapp.
Used this tutorial moving step by step I ran into a problem: my test fails because the counter is not incrementing (I left log there)
I’m changed the contract a bit: added init func, return changed value from increment func and added logs after each call and this test
Here is my repo GitHub - chlenc/fuel-project
This is main.sw file fuel-project/main.sw at master · chlenc/fuel-project · GitHub
This is my test file fuel-project/harness.rs at master · chlenc/fuel-project · GitHub
Thanks!
The test
let (instance, _id) = get_contract_instance().await;
let init_result = instance.methods().init(1).call().await.unwrap();
println!("0️⃣ Init result: {}",init_result.value);
let increment_result = instance.methods().increment(1).call().await.unwrap();
println!("1️⃣ Increment result: {}",increment_result.value);
let result = instance.methods().count().call().await.unwrap();
println!("✅ Count: {}",result.value);
assert_eq!(result.value, 2);
make output like that
0️⃣ Init result: 1
1️⃣ Increment result: 1
✅ Count: 0