Skip to content

Commit 079bfe6

Browse files
committed
unit tests to validate call response script output
1 parent ac261cd commit 079bfe6

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

forc-plugins/forc-client/src/op/call/call_function.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ pub mod tests {
467467
cmd,
468468
op::call::{call, get_wallet, PrivateKeySigner},
469469
};
470+
use fuel_tx::field::Outputs;
470471
use fuels::{crypto::SecretKey, prelude::*};
471472
use std::path::PathBuf;
472473

@@ -950,15 +951,9 @@ pub mod tests {
950951
gas_forwarded: None,
951952
};
952953
// validate balance is unchanged (dry-run)
953-
assert_eq!(
954-
call(operation.clone(), cmd.clone())
955-
.await
956-
.unwrap()
957-
.result
958-
.unwrap(),
959-
"()"
960-
);
961-
assert_eq!(get_contract_balance(id_2, provider.clone()).await, 0);
954+
let call_response = call(operation.clone(), cmd.clone()).await.unwrap();
955+
assert_eq!(call_response.result.unwrap(), "()");
956+
assert_eq!(call_response.script.unwrap().outputs().len(), 2);
962957
cmd.mode = cmd::call::ExecutionMode::Live;
963958
assert_eq!(call(operation, cmd).await.unwrap().result.unwrap(), "()");
964959
assert_eq!(get_contract_balance(id_2, provider.clone()).await, 1);
@@ -985,7 +980,9 @@ pub mod tests {
985980
};
986981
cmd.mode = cmd::call::ExecutionMode::Live;
987982
let operation = cmd.validate_and_get_operation().unwrap();
988-
assert_eq!(call(operation, cmd).await.unwrap().result.unwrap(), "()");
983+
let call_response = call(operation, cmd).await.unwrap();
984+
assert_eq!(call_response.result.unwrap(), "()");
985+
assert_eq!(call_response.script.unwrap().outputs().len(), 3);
989986
assert_eq!(
990987
get_recipient_balance(random_wallet.address(), provider.clone()).await,
991988
2
@@ -1043,7 +1040,9 @@ pub mod tests {
10431040
};
10441041
cmd.mode = cmd::call::ExecutionMode::Live;
10451042
let operation = cmd.validate_and_get_operation().unwrap();
1046-
assert_eq!(call(operation, cmd).await.unwrap().result.unwrap(), "()");
1043+
let call_response = call(operation, cmd).await.unwrap();
1044+
assert_eq!(call_response.result.unwrap(), "()");
1045+
assert_eq!(call_response.script.unwrap().outputs().len(), 3);
10471046
assert_eq!(
10481047
get_recipient_balance(random_wallet.address(), provider.clone()).await,
10491048
3

0 commit comments

Comments
 (0)