summaryrefslogtreecommitdiff
path: root/tests/cli.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cli.rs')
-rw-r--r--tests/cli.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/cli.rs b/tests/cli.rs
index 41fe145..7bda913 100644
--- a/tests/cli.rs
+++ b/tests/cli.rs
@@ -98,6 +98,10 @@ fn verify_repo_exists(repo_dir: &Path) {
.stdout("");
}
+fn verify_repo_does_not_exist(repo_dir: &Path) {
+ assert!(!repo_dir.exists());
+}
+
fn verify_current_branch(repo_dir: &Path, expected_ref: &str) {
Command::new("git")
.arg("symbolic-ref")
@@ -423,3 +427,28 @@ fn can_change_the_main_branch_on_a_repo() -> Result<()> {
Ok(())
}
+
+#[test]
+fn can_delete_a_repo() -> Result<()> {
+ let mut c = spawn_interactive_process()?;
+ let username = get_username().unwrap();
+ let repo_name = "an-old-repo";
+ let repo_path = format!("git/{username}/{repo_name}.git");
+ let repo_dir = c
+ .workdir
+ .as_ref()
+ .join("git")
+ .join(username)
+ .join(&format!("{}.git", repo_name));
+
+ c.p.send_line(&format!("init {}", repo_name))?;
+ c.p.exp_string(&format!("Successfully created \"{repo_path}\""))?;
+ verify_repo_exists(&repo_dir);
+
+ c.p.send_line(&format!("delete \"{repo_path}\""))?;
+ c.p.exp_string(&format!("Successfully deleted \"{repo_path}\""))?;
+
+ verify_repo_does_not_exist(&repo_dir);
+
+ Ok(())
+}