From 3d62e6a191df1ddd571d38d0ddf5c0a6fc0ba1e8 Mon Sep 17 00:00:00 2001 From: damirka Date: Wed, 28 Apr 2021 15:12:08 +0300 Subject: [PATCH] adds tests for imports --- leo/main.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/leo/main.rs b/leo/main.rs index b2af6ba95e..7d92f4f087 100644 --- a/leo/main.rs +++ b/leo/main.rs @@ -358,6 +358,23 @@ mod cli_tests { 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] fn test_missing_file() { let dir = testdir("test");