aboutsummaryrefslogtreecommitdiffstats
path: root/tests/providers.bats
diff options
context:
space:
mode:
authorMoritz Meißelbach <m.meisselbach@inpsyde.com>2019-11-29 21:28:24 +0100
committerMoritz Meißelbach <m.meisselbach@inpsyde.com>2019-11-29 21:28:24 +0100
commit3835562c5325c279809bb41c34c6afca6288a1cb (patch)
tree7bbf1910d43d9a512146bc5a4cb11842e66bf0d3 /tests/providers.bats
parent22182d980a2ebde89fe2970e11c39fbf8e4d6628 (diff)
downloadsway-launcher-desktop-3835562c5325c279809bb41c34c6afca6288a1cb.tar.gz
sway-launcher-desktop-3835562c5325c279809bb41c34c6afca6288a1cb.zip
[WIP] Read custom providers from a ~/.config/sway-launcher-desktop/providers.conf file.
Diffstat (limited to 'tests/providers.bats')
-rw-r--r--tests/providers.bats36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/providers.bats b/tests/providers.bats
new file mode 100644
index 0000000..1c11f0d
--- /dev/null
+++ b/tests/providers.bats
@@ -0,0 +1,36 @@
+@test "Builtin desktop provider works" {
+ run env XDG_CONFIG_HOME=./data/config XDG_DATA_HOME=./data/desktop-files/1 XDG_DATA_DIRS=./data/desktop-files/0 ../sway-launcher-desktop.sh provide desktop
+ echo "OUTPUT:$output"
+ echo "LINES:${#lines[@]}"
+ [ "$status" -eq 0 ]
+ [[ ${#lines[@]} -gt 2 ]]
+}
+
+@test "Builtin command provider works" {
+ run env XDG_CONFIG_HOME=./data/config XDG_DATA_HOME=./data/desktop-files/1 XDG_DATA_DIRS=./data/desktop-files/0 ../sway-launcher-desktop.sh provide command
+ echo "OUTPUT:$output"
+ echo "LINES:${#lines[@]}"
+ [ "$status" -eq 0 ]
+ [[ ${#lines[@]} -gt 2 ]]
+}
+
+@test "Reads custom provider from providers.conf" {
+ run printf %q "$(env XDG_CONFIG_HOME=./data/config/0 ../sway-launcher-desktop.sh provide foo)"
+ echo "OUTPUT:$output"
+ [ "$status" -eq 0 ]
+ [[ ${output} == "$'foo\034foo'" ]]
+}
+
+@test "Skips incomplete custom provider from providers.conf" {
+ run printf %q "$(env XDG_CONFIG_HOME=./data/config/0 ../sway-launcher-desktop.sh provide incomplete)"
+ echo "OUTPUT:$output"
+ [ "$status" -eq 0 ]
+ [[ ${output} == "''" ]]
+}
+
+@test "Does not use builtin providers when reading from providers.conf" {
+ run printf %q "$(env XDG_CONFIG_HOME=./data/config/0 ../sway-launcher-desktop.sh provide desktop)"
+ echo "OUTPUT:$output"
+ [ "$status" -eq 0 ]
+ [[ ${output} == "''" ]]
+}