1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-15 15:10:07 +00:00

feat: overhaul quality checks and expand test suite for clean and optimize features

This commit is contained in:
Tw93
2025-12-31 18:13:37 +08:00
parent 1e8ff30fa1
commit 592f02e6e2
45 changed files with 1506 additions and 910 deletions

View File

@@ -26,13 +26,10 @@ setup() {
}
@test "load_purge_config loads default paths when config file is missing" {
# Source the file in a subshell to avoid polluting test environment variables
# We need to export HOME so it's picked up by the script
run env HOME="$HOME" bash -c "source '$PROJECT_ROOT/lib/clean/project.sh'; echo \"\${PURGE_SEARCH_PATHS[*]}\""
[ "$status" -eq 0 ]
# Check for a few expected default paths
[[ "$output" == *"$HOME/Projects"* ]]
[[ "$output" == *"$HOME/GitHub"* ]]
[[ "$output" == *"$HOME/dev"* ]]
@@ -52,7 +49,6 @@ EOF
[[ "$output" == *"$HOME/custom/projects"* ]]
[[ "$output" == *"$HOME/work"* ]]
# Should NOT have default paths
[[ "$output" != *"$HOME/GitHub"* ]]
}
@@ -77,10 +73,8 @@ EOF
local config_file="$HOME/.config/mole/purge_paths"
cat > "$config_file" << EOF
# This is a comment
$HOME/valid/path
# Indented comment
$HOME/another/path
EOF
@@ -91,7 +85,6 @@ EOF
local lines
read -r -a lines <<< "$output"
# First line of output is count
local count="${lines[0]}"
[ "$count" -eq 2 ]
@@ -107,7 +100,6 @@ EOF
[ "$status" -eq 0 ]
# Should have default paths
[[ "$output" == *"$HOME/Projects"* ]]
}
@@ -119,6 +111,5 @@ EOF
[ "$status" -eq 0 ]
# Should have default paths
[[ "$output" == *"$HOME/Projects"* ]]
}