feat: add bats tests, docs (#139)

* fix(test): ensure bats file list uses xargs

* docs(readme): use yarn for testing instructions

* fix(test): ensure pipelines fail properly

* docs(alias): fix table header

---------

Signed-off-by: Ismo Vuorinen <ismo@ivuorinen.net>
This commit is contained in:
2025-06-30 04:30:06 +03:00
committed by GitHub
parent 1531647e01
commit cf7ca2109f
82 changed files with 1368 additions and 16 deletions

View File

@@ -56,22 +56,31 @@ __pushover_send_message()
response="$(eval "${curl_cmd}")"
printf "%s\n" "$response"
# TODO: Parse response
r="${?}"
if [ "${r}" -ne 0 ]; then
printf "%s: Failed to send message\n" "${0}" >&2
# Parse response status. Expect JSON like: {"status":1,"request":"..."}
if echo "$response" | grep -q '"status"[[:space:]]*:[[:space:]]*1'; then
r=0
else
r=1
fi
return "${r}"
if [ "$r" -ne 0 ]; then
# Extract possible error message from JSON
err=$(echo "$response" | grep -o '"errors".*' | sed 's/"errors"[:,\[]//g' | tr -d '[]"')
[ -n "$err" ] && printf "%s: %s\n" "$0" "$err" >&2
printf "%s: Failed to send message\n" "$0" >&2
fi
return "$r"
}
CURL="$(which curl)"
CURL="$(command -v curl)"
PUSHOVER_URL="https://api.pushover.net/1/messages.json"
TOKEN=$PUSHOVER_TOKEN
USER=$PUSHOVER_USER
CURL_OPTS=""
devices="${devices} ${device}"
optstring="c:d:D:e:f:p:r:t:T:s:u:U:a:h"
devices=""
optstring="c:d:D:e:p:r:t:T:s:u:U:a:h"
OPTIND=1
while getopts ${optstring} c; do
@@ -97,7 +106,7 @@ while getopts ${optstring} c; do
t)
title="${OPTARG}"
;;
k)
T)
TOKEN="${OPTARG}"
;;
s)