From: Bastian Dehn Date: Mon, 3 Aug 2026 15:49:13 +0000 (+0200) Subject: add test for jq command check X-Git-Tag: v1.0.6^2~1^2~78 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=36bfab018f1a88b620e3414940ae637c24cd8148;p=simple-backup.git add test for jq command check --- diff --git a/src/backup b/src/backup index 5c8e95f..9469b5a 100755 --- a/src/backup +++ b/src/backup @@ -16,6 +16,9 @@ main() command -v yq > /dev/null \ || errlog "command yq not found" \ || return $? + command -v jq > /dev/null \ + || errlog "command jq not found" \ + || return $? } [ "$TESTMODE" == "ON" ] || return 0 diff --git a/tests/backup_tests.bats b/tests/backup_tests.bats index 25cbdad..31a0863 100755 --- a/tests/backup_tests.bats +++ b/tests/backup_tests.bats @@ -34,4 +34,16 @@ teardown() { assert_failure assert_line --index 0 "⭐ START: backup" assert_line --index 1 "❌ ERROR: command yq not found" -} \ No newline at end of file +} + +@test "failure jq command not found" { + command() { + [ "$2" != "jq" ] || return 1 + } + + run main + + assert_failure + assert_line --index 0 "⭐ START: backup" + assert_line --index 1 "❌ ERROR: command jq not found" +}