Skip to content

Commit

Permalink
Refactor(Tests): Move test contracts to test etc folder (#577)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Birch <[email protected]>
  • Loading branch information
joshuajbouw and birchmd committed Aug 18, 2022
1 parent 43ed909 commit c45e62f
Show file tree
Hide file tree
Showing 23 changed files with 25 additions and 3,137 deletions.
10 changes: 2 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,10 @@
# Rust artifacts
bin/
target/
etc/tests/*/target/
etc/tests/*/Cargo.lock

# Solidity artifacts
artifacts/
cache/
node_modules/

# Other
etc/state-migration-test/target/
etc/ft-receiver/target/
etc/self-contained-5bEgfRQ/target/

node_modules/*
cache
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ members = [
"engine-types",
]
exclude = [
"etc/state-migration-test",
"etc/ft-receiver",
"etc/benchmark-contract",
"etc/self-contained-5bEgfRQ",
"etc/tests/state-migration-test",
"etc/tests/ft-receiver",
"etc/tests/benchmark-contract",
"etc/tests/self-contained-5bEgfRQ",
]
4 changes: 3 additions & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ script = '''
rm -Rf etc/eth-contracts/.pnp
rm -Rf etc/eth-contracts/artifacts
rm -Rf etc/eth-contracts/cache
rm -Rf etc/benchmark-contract/target
rm -Rf etc/tests/benchmark-contract/target
rm -Rf etc/tests/ft-receiver/target
rm -Rf etc/tests/self-contained-5bEgfRQ/target
'''

[tasks.clean-bin]
Expand Down
2 changes: 1 addition & 1 deletion engine-tests/src/test_utils/uniswap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ fn load_constructor(artifact_path: PathBuf) -> solidity::ContractConstructor {
}

fn uniswap_root_path() -> PathBuf {
Path::new("..").join("etc").join("uniswap")
Path::new("../etc").join("tests").join("uniswap")
}

fn download_uniswap_artifacts() {
Expand Down
4 changes: 3 additions & 1 deletion engine-tests/src/tests/eth_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,9 @@ fn test_ft_transfer_wrong_u128_json_type() {

/// Bytes for a NEAR smart contract implementing `ft_on_transfer`
fn dummy_ft_receiver_bytes() -> Vec<u8> {
let base_path = std::path::Path::new("../etc").join("ft-receiver");
let base_path = std::path::Path::new("../etc")
.join("tests")
.join("ft-receiver");
let output_path = base_path.join("target/wasm32-unknown-unknown/release/ft_receiver.wasm");
crate::test_utils::rust::compile(base_path);
std::fs::read(output_path).unwrap()
Expand Down
4 changes: 3 additions & 1 deletion engine-tests/src/tests/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ fn test_solidity_pure_bench() {
);

// Pure rust version of the same contract
let base_path = std::path::Path::new("../etc").join("benchmark-contract");
let base_path = std::path::Path::new("../etc")
.join("tests")
.join("benchmark-contract");
let output_path =
base_path.join("target/wasm32-unknown-unknown/release/benchmark_contract.wasm");
test_utils::rust::compile(base_path);
Expand Down
4 changes: 3 additions & 1 deletion engine-tests/src/tests/state_migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ impl AuroraAccount {
}

fn contract_bytes() -> Vec<u8> {
let base_path = Path::new("../etc").join("state-migration-test");
let base_path = Path::new("../etc")
.join("tests")
.join("state-migration-test");
let output_path = base_path
.join("target/wasm32-unknown-unknown/release/aurora_engine_state_migration_test.wasm");
test_utils::rust::compile(base_path);
Expand Down
62 changes: 0 additions & 62 deletions etc/benchmark-contract/Cargo.lock

This file was deleted.

Loading

0 comments on commit c45e62f

Please sign in to comment.