1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-23 21:35:06 +00:00

fix(clean): align threshold colors with displayed GB units

This commit is contained in:
Tw93
2026-03-23 20:18:06 +08:00
parent 5df81a2314
commit 9757063736
2 changed files with 9 additions and 5 deletions

View File

@@ -44,13 +44,16 @@ setup() {
[[ -n "$result" ]]
}
@test "cleanup_result_color_kb switches from yellow to green at 1 GiB" {
@test "cleanup_result_color_kb switches from yellow to green at 1 GB" {
run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" bash --noprofile --norc <<'EOF'
set -euo pipefail
source "$PROJECT_ROOT/lib/core/common.sh"
if [[ "$(cleanup_result_color_kb $((MOLE_ONE_GIB_KB - 1)))" == "$YELLOW" ]] &&
[[ "$(cleanup_result_color_kb "$MOLE_ONE_GIB_KB")" == "$GREEN" ]]; then
below_threshold_kb=$(((MOLE_ONE_GB_BYTES - 1) / 1024))
at_threshold_kb=$(((MOLE_ONE_GB_BYTES + 1023) / 1024))
if [[ "$(cleanup_result_color_kb "$below_threshold_kb")" == "$YELLOW" ]] &&
[[ "$(cleanup_result_color_kb "$at_threshold_kb")" == "$GREEN" ]]; then
echo "ok"
fi
EOF