Skip to content

Commit

Permalink
test: fix tests as per changes of api and logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dj8yf0μl committed Dec 4, 2024
1 parent 499ccc1 commit 2878f94
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
2 changes: 2 additions & 0 deletions cargo-near-build/src/types/near/build/input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ mod tests {
assert_eq!(opts.get_cli_command_for_lib_context(), ["cargo".to_string(),
"near".to_string(),
"build".to_string(),
"non-reproducible-wasm".to_string(),
"--locked".to_string(),
"--env".to_string(),
"KEY=VALUE".to_string(),
"--env".to_string(),
Expand Down
35 changes: 23 additions & 12 deletions integration-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ macro_rules! invoke_cargo_near {
let path: camino::Utf8PathBuf = match cli_args.cmd {
Some(cargo_near::commands::CliNearCommand::Abi(cmd)) => {
let args = cargo_near_build::abi::AbiOpts {
no_locked: cmd.no_locked,
no_locked: !cmd.locked,
no_doc: cmd.no_doc,
compact_abi: cmd.compact_abi,
out_dir: cmd.out_dir.map(Into::into),
Expand All @@ -87,14 +87,25 @@ macro_rules! invoke_cargo_near {
let path = cargo_near_build::abi::build(args)?;
path
},
Some(cargo_near::commands::CliNearCommand::Build(cmd)) => {
let args = {
let mut args = cargo_near::commands::build_command::BuildCommand::from(cmd) ;
args.manifest_path = Some(cargo_path.into());
args
Some(cargo_near::commands::CliNearCommand::Build(
cargo_near::commands::build::CliCommand {
actions:
Some(cargo_near::commands::build::actions::CliActions::NonReproducibleWasm(
cli_build_otps,
)),
},
)) => {
let build_opts = {
let mut build_opts =
cargo_near::commands::build::actions::non_reproducible_wasm::BuildOpts::from(
cli_build_otps,
);
build_opts.manifest_path = Some(cargo_path.into());
build_opts
};
tracing::debug!("BuildCommand: {:#?}", args);
let artifact = args.run(cargo_near_build::BuildContext::Build)?;
tracing::debug!("non_reproducible_wasm::BuildOpts: {:#?}", build_opts);

let artifact = cargo_near::commands::build::actions::non_reproducible_wasm::run(build_opts)?;
artifact.path
},
Some(_) => todo!(),
Expand All @@ -108,8 +119,8 @@ macro_rules! invoke_cargo_near {
#[macro_export]
macro_rules! generate_abi_with {
($(Cargo: $cargo_path:expr;)? $(Vars: $cargo_vars:expr;)? $(Opts: $cli_opts:expr;)? Code: $($code:tt)*) => {{
let opts = "cargo near abi --no-locked";
$(let opts = format!("cargo near abi --no-locked {}", $cli_opts);)?;
let opts = "cargo near abi";
$(let opts = format!("cargo near abi {}", $cli_opts);)?;
let result_file = $crate::invoke_cargo_near! {
$(Cargo: $cargo_path;)? $(Vars: $cargo_vars;)?
Opts: &opts;
Expand Down Expand Up @@ -178,8 +189,8 @@ pub struct BuildResult {
#[macro_export]
macro_rules! build_with {
($(Cargo: $cargo_path:expr;)? $(Vars: $cargo_vars:expr;)? $(Opts: $cli_opts:expr;)? Code: $($code:tt)*) => {{
let opts = "cargo near build --no-docker --no-locked";
$(let opts = format!("cargo near build --no-docker --no-locked {}", $cli_opts);)?;
let opts = "cargo near build non-reproducible-wasm";
$(let opts = format!("cargo near build non-reproducible-wasm {}", $cli_opts);)?;
let result_file = $crate::invoke_cargo_near! {
$(Cargo: $cargo_path;)? $(Vars: $cargo_vars;)?
Opts: &opts;
Expand Down

0 comments on commit 2878f94

Please sign in to comment.