]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
add test for jq command check
authorBastian Dehn <hhaalo@arcor.de>
Mon, 3 Aug 2026 15:49:13 +0000 (17:49 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 3 Aug 2026 15:49:13 +0000 (17:49 +0200)
src/backup
tests/backup_tests.bats

index 5c8e95fe73a9c5895472f56a12c39372b247637e..9469b5a2165aaaeee509af09cd34b20a14a8f2fd 100755 (executable)
@@ -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
index 25cbdad34a909ca005087a2291be22702053ee9c..31a0863b659ce15994f89a2d875dc35a4d08240a 100755 (executable)
@@ -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"
+}