Skip to content

Commit

Permalink
test: added e2e test for mise prune (#3119)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx authored Nov 21, 2024
1 parent 0c10d0a commit 3a02b42
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
17 changes: 17 additions & 0 deletions e2e/cli/test_prune
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

assert "mise use [email protected] [email protected]"
assert "mise use [email protected] [email protected]"
cd "$(mktemp -d)" || exit 1 # mise should not prune these files even though they're from some other directory

assert_contains "mise prune --dry-run 2>&1" "mise [email protected] [dryrun]"
assert_contains "mise prune --dry-run 2>&1" "mise [email protected] [dryrun]"
assert "ls $MISE_DATA_DIR/installs/dummy/2.0.0"
assert "ls $MISE_DATA_DIR/installs/tiny/2.0.0"
assert "mise prune tiny"
assert "ls $MISE_DATA_DIR/installs/dummy/2.0.0"
assert_fail "ls $MISE_DATA_DIR/installs/tiny/2.0.0"
assert "mise prune"
assert_fail "ls $MISE_DATA_DIR/installs/dummy/2.0.0"
assert "ls $MISE_DATA_DIR/installs/dummy/3.0.0"
assert "ls $MISE_DATA_DIR/installs/tiny/3.0.0"
15 changes: 0 additions & 15 deletions src/cli/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,3 @@ static AFTER_LONG_HELP: &str = color_print::cstr!(
rm -rf ~/.local/share/mise/versions/node/20.0.1
"#
);

#[cfg(test)]
mod tests {
use crate::test::reset;
use test_log::test;

#[test]
fn test_prune() {
reset();
assert_cli!("prune", "--dry-run");
assert_cli!("prune", "tiny");
assert_cli!("prune");
assert_cli!("install");
}
}

0 comments on commit 3a02b42

Please sign in to comment.