Skip to content

Commit

Permalink
add contract build unit test. (#949)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsachiherman authored Sep 11, 2023
1 parent 41f9f8f commit c1db31b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cmd/crates/soroban-test/tests/it/contract_sandbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use soroban_cli::commands::{
contract::{self, fetch},
};
use soroban_test::TestEnv;
use std::path::PathBuf;

use crate::util::{
add_test_seed, DEFAULT_PUB_KEY, DEFAULT_PUB_KEY_1, DEFAULT_SECRET_KEY, DEFAULT_SEED_PHRASE,
Expand Down Expand Up @@ -444,3 +445,23 @@ async fn fetch() {
cmd.run().await.unwrap();
assert!(f.exists());
}

#[test]
fn build() {
let sandbox = TestEnv::default();

let cargo_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let hello_world_contract_path =
cargo_dir.join("tests/fixtures/test-wasms/hello_world/Cargo.toml");
sandbox
.new_assert_cmd("contract")
.arg("build")
.arg("--manifest-path")
.arg(hello_world_contract_path)
.arg("--profile")
.arg("test-wasms")
.arg("--package")
.arg("test_hello_world")
.assert()
.success();
}

0 comments on commit c1db31b

Please sign in to comment.