Merge pull request #901 from AleoHQ/more-cli-tests

[CLI] Adds tests for imports
This commit is contained in:
Collin Chin 2021-04-28 14:08:15 -07:00 committed by GitHub
commit 5e281bf93d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -358,6 +358,23 @@ mod cli_tests {
assert!(run_cmd("leo clean", setup_path).is_ok()); assert!(run_cmd("leo clean", setup_path).is_ok());
} }
#[test]
fn test_import() {
let dir = testdir("test");
let path = dir.path("test");
assert!(run_cmd("leo new import", &Some(path.clone())).is_ok());
let import_path = &Some(path.join("import"));
assert!(run_cmd("leo add no-package/definitely-no", import_path).is_err());
assert!(run_cmd("leo add justice-league/u8u32", import_path).is_ok());
assert!(run_cmd("leo remove u8u32", import_path).is_ok());
assert!(run_cmd("leo add --author justice-league --package u8u32", import_path).is_ok());
assert!(run_cmd("leo remove u8u32", import_path).is_ok());
assert!(run_cmd("leo remove u8u32", import_path).is_err());
}
#[test] #[test]
fn test_missing_file() { fn test_missing_file() {
let dir = testdir("test"); let dir = testdir("test");