Skip to content

Commit

Permalink
test/battery: fix tests…
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelicWizard committed Mar 4, 2022
1 parent 7d77c74 commit 0dacbcb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/plugins/battery.plugin.bats
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ function setup_acpi {
# Creates a `upower` function that simulates output like the real `upower` command.
# The passed in parameter is used for the remaining battery percentage.
function setup_upower {
trap -p PIPE | grep -q PIPE || trap '' PIPE
percent="$1"
BAT0="/org/freedesktop/UPower/devices/battery_BAT$RANDOM"

function upower {
case $1 in
'-e'|'--enumerate')
# don't just `echo` twice because `grep` will close the pipe after matching the first line...
echo "$BAT0"$'\n'"/org/freedesktop/UPower/devices/mouse_hid_${RANDOM}_battery"
printf '%s\n' "$BAT0" "/org/freedesktop/UPower/devices/mouse_hid_${RANDOM}_battery"
;;
'-i'|'--show-info')
if [[ $2 == "$BAT0" ]]
Expand Down

0 comments on commit 0dacbcb

Please sign in to comment.