|| return $?
exists_config_file "$CONFIG_FILE" \
|| return $?
+
+ local config=
+ config=$(yq '.' "$CONFIG_FILE") \
+ || errlog "failed to load $CONFIG_FILE" \
+ || return $?
}
[ "$TESTMODE" == "ON" ] && return 0
}
@test "backup run success" {
+ yq() {
+ return 0
+ }
run main
assert_success
}
@test "show start message" {
+ yq() {
+ return 0
+ }
run main
assert_success
assert_line --index 0 "⭐ START: backup"
assert_line --index 1 "❌ ERROR: file config.yaml not found"
}
+
+@test "failure load config.yaml" {
+ yq() {
+ return 1
+ }
+
+ run main
+
+ assert_line --index 0 "⭐ START: backup"
+ assert_line --index 1 "❌ ERROR: failed to load config.yaml"
+}
\ No newline at end of file