-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b5e8c19
commit 3583ae4
Showing
2 changed files
with
117 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env bats | ||
|
||
function setup() { | ||
load "$HOME/shell-testing/test_helper/bats-support/load" | ||
load "$HOME/shell-testing/test_helper/bats-assert/load" | ||
load ../../utils/constants.sh | ||
load ../../utils/common.sh | ||
LOG_FILE=/tmp/ovos-installer.log | ||
} | ||
|
||
@test "function_detect_sound_pulseaudio" { | ||
function pgrep() { | ||
echo "pulse" | ||
} | ||
function command() { | ||
return 0 | ||
} | ||
function pactl() { | ||
echo "Server Name: pulseaudio" | ||
} | ||
export -f pgrep command pactl | ||
detect_sound | ||
echo "$SOUND_SERVER" | ||
[ "$SOUND_SERVER" == "pulseaudio" ] | ||
unset pgrep command pactl | ||
} | ||
|
||
@test "function_detect_sound_pulseaudio_via_pipewire" { | ||
function pgrep() { | ||
echo "pulse" | ||
} | ||
function command() { | ||
return 1 | ||
} | ||
export -f pgrep command | ||
detect_sound | ||
echo "$SOUND_SERVER" | ||
[ "$SOUND_SERVER" == "PulseAudio (on PipeWire)" ] | ||
unset pgrep command | ||
} | ||
|
||
@test "function_detect_sound_pipewire" { | ||
function pgrep() { | ||
echo "pipewire" | ||
} | ||
export -f pgrep | ||
detect_sound | ||
echo "$SOUND_SERVER" | ||
[ "$SOUND_SERVER" == "PipeWire" ] | ||
unset pgrep | ||
} | ||
|
||
@test "function_detect_sound_no_audio" { | ||
run touch "$LOG_FILE" | ||
function pgrep() { | ||
return 1 | ||
} | ||
export -f pgrep | ||
detect_sound | ||
echo "$SOUND_SERVER" | ||
[ "$SOUND_SERVER" == "N/A" ] | ||
unset pgrep | ||
} |