Skip to content

Fix-refactor file structure for improved code quality around cli testing #7132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions forc-plugins/forc-client/src/op/call/call_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ pub mod tests {
cmd::Call {
address: (*id).into(),
abi: Some(Either::Left(std::path::PathBuf::from(
"../../forc-plugins/forc-client/test/data/contract_with_types/contract_with_types-abi.json",
"../../forc-plugins/forc-client/tests/data/contract_with_types/contract_with_types-abi.json",
))),
function: Some(selector.to_string()),
function_args: args.into_iter().map(String::from).collect(),
Expand All @@ -318,7 +318,8 @@ pub mod tests {

abigen!(Contract(
name = "TestContract",
abi = "forc-plugins/forc-client/test/data/contract_with_types/contract_with_types-abi.json"
abi =
"forc-plugins/forc-client/tests/data/contract_with_types/contract_with_types-abi.json"
));

pub async fn get_contract_instance() -> (TestContract<Wallet>, ContractId, Provider, SecretKey)
Expand All @@ -334,7 +335,7 @@ pub mod tests {
.unwrap();

let id = Contract::load_from(
"../../forc-plugins/forc-client/test/data/contract_with_types/contract_with_types.bin",
"../../forc-plugins/forc-client/tests/data/contract_with_types/contract_with_types.bin",
LoadConfiguration::default(),
)
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion forc-plugins/forc-client/src/op/call/list_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ mod tests {
let (_, id, _, _) = get_contract_instance().await;

// Load a test ABI
let abi_path_str = "../../forc-plugins/forc-client/test/data/contract_with_types/contract_with_types-abi.json";
let abi_path_str = "../../forc-plugins/forc-client/tests/data/contract_with_types/contract_with_types-abi.json";
let abi_path = Path::new(abi_path_str);
let abi = Either::Left(abi_path.to_path_buf());

Expand Down
5 changes: 3 additions & 2 deletions forc-plugins/forc-client/src/op/call/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ pub(crate) mod tests {

abigen!(Contract(
name = "TestContract",
abi = "forc-plugins/forc-client/test/data/contract_with_types/contract_with_types-abi.json"
abi =
"forc-plugins/forc-client/tests/data/contract_with_types/contract_with_types-abi.json"
));

pub async fn get_contract_instance() -> (TestContract<Wallet>, ContractId, Provider, SecretKey)
Expand All @@ -280,7 +281,7 @@ pub(crate) mod tests {
.unwrap();

let id = Contract::load_from(
"../../forc-plugins/forc-client/test/data/contract_with_types/contract_with_types.bin",
"../../forc-plugins/forc-client/tests/data/contract_with_types/contract_with_types.bin",
LoadConfiguration::default(),
)
.unwrap()
Expand Down
14 changes: 8 additions & 6 deletions forc-plugins/forc-client/tests/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ fn update_main_sw(tmp_dir: &Path) -> anyhow::Result<()> {
async fn assert_big_contract_calls(wallet: Wallet, contract_id: ContractId) {
abigen!(Contract(
name = "BigContract",
abi = "forc-plugins/forc-client/test/data/big_contract/big_contract-abi.json"
abi = "forc-plugins/forc-client/tests/data/big_contract/big_contract-abi.json"
));

let instance = BigContract::new(contract_id, wallet);
Expand Down Expand Up @@ -530,7 +530,8 @@ async fn test_proxy_contract_re_routes_call() {

abigen!(Contract(
name = "ImplementationContract",
abi = "forc-plugins/forc-client/test/data/standalone_contract/standalone_contract-abi.json"
abi =
"forc-plugins/forc-client/tests/data/standalone_contract/standalone_contract-abi.json"
));

let impl_contract_a = ImplementationContract::new(proxy_contract_id, wallet_unlocked.clone());
Expand Down Expand Up @@ -943,7 +944,8 @@ async fn deploy_script_calls() {

abigen!(Script(
name = "MyScript",
abi = "forc-plugins/forc-client/test/data/deployed_script/deployed_script-abi.json"
abi =
"forc-plugins/forc-client/tests/data/deployed_script/deployed_script-abi.json"
));

let provider = Provider::connect(&node_url).await.unwrap();
Expand Down Expand Up @@ -1070,7 +1072,7 @@ async fn deployed_predicate_call() {

abigen!(Predicate(
name = "MyPredicate",
abi = "forc-plugins/forc-client/test/data/deployed_predicate/deployed_predicate-abi.json"
abi = "forc-plugins/forc-client/tests/data/deployed_predicate/deployed_predicate-abi.json"
));

let provider = Provider::connect(&node_url).await.unwrap();
Expand Down Expand Up @@ -1133,7 +1135,7 @@ async fn call_with_sdk_generated_overrides(node_url: &str, contract_id: Contract
let project_dir = test_data_path().join("deployed_script");
abigen!(Script(
name = "MyScript",
abi = "forc-plugins/forc-client/test/data/deployed_script/deployed_script-abi.json"
abi = "forc-plugins/forc-client/tests/data/deployed_script/deployed_script-abi.json"
));
let provider = Provider::connect(&node_url).await.unwrap();
let secret_key = SecretKey::from_str(forc_client::constants::DEFAULT_PRIVATE_KEY).unwrap();
Expand Down Expand Up @@ -1236,7 +1238,7 @@ async fn call_with_forc_generated_overrides(node_url: &str, contract_id: Contrac
let generated_loader_bin = tmp_dir.path().join("out/deployed_script-loader.bin");
abigen!(Script(
name = "MyScript",
abi = "forc-plugins/forc-client/test/data/deployed_script/deployed_script-loader-abi.json"
abi = "forc-plugins/forc-client/tests/data/deployed_script/deployed_script-loader-abi.json"
));
let forc_generated_script_instance = MyScript::new(
wallet_unlocked,
Expand Down