adds tests for imports

This commit is contained in:
damirka 2021-04-28 15:12:08 +03:00
parent 9cfc72519d
commit 3d62e6a191

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");