config=$(yq '.' "$CONFIG_FILE") \
|| errlog "failed to load $CONFIG_FILE" \
|| return $?
+
+ local backup_path=
+ backup_path=$(echo "$config" | jq --raw-output '.backup_path')
+ [ "$backup_path" != "null" ] \
+ || errlog "$CONFIG_FILE missing backup_path" \
+ || return $?
}
[ "$TESTMODE" == "ON" ] && return 0
assert_line --index 0 "⭐ START: backup"
assert_line --index 1 "❌ ERROR: failed to load src/config-example.yaml"
+}
+
+@test "failure no backup path in config" {
+ yq() {
+ echo "{}"
+ }
+
+ run main
+
+ assert_line --index 0 "⭐ START: backup"
+ assert_line --index 1 "❌ ERROR: src/config-example.yaml missing backup_path"
}
\ No newline at end of file