Add tests for base theme's battery functions

pull/974/head
Nils Winkler 2017-05-30 08:33:07 +02:00
parent 0aad8b4ab0
commit b55c0251ed
2 changed files with 70 additions and 1 deletions

View File

@ -9,4 +9,4 @@ if [ -z "${BASH_IT}" ]; then
export BASH_IT=$(cd ${test_directory} && dirname $(pwd)) export BASH_IT=$(cd ${test_directory} && dirname $(pwd))
fi fi
exec $bats_executable ${CI:+--tap} ${test_directory}/{install,lib,plugins} exec $bats_executable ${CI:+--tap} ${test_directory}/{install,lib,plugins,themes}

View File

@ -0,0 +1,69 @@
#!/usr/bin/env bats
load ../test_helper
load ../../lib/composure
load ../../plugins/available/base.plugin
load ../../themes/base.theme
@test 'themes base: battery_percentage should not exist' {
run type -a battery_percentage &> /dev/null
assert_failure
}
@test 'themes base: battery_percentage should exist if battery plugin loaded' {
load ../../plugins/available/battery.plugin
run type -a battery_percentage &> /dev/null
assert_success
}
@test 'themes base: battery_char should exist' {
run type -a battery_char &> /dev/null
assert_success
run battery_char
assert_success
assert_line "0" ""
run type -a battery_char
assert_line " echo -n"
}
@test 'themes base: battery_char should exist if battery plugin loaded' {
unset -f battery_char
load ../../plugins/available/battery.plugin
load ../../themes/base.theme
run type -a battery_char &> /dev/null
assert_success
run battery_char
assert_success
run type -a battery_char
assert_line ' if [[ "${THEME_BATTERY_PERCENTAGE_CHECK}" = true ]]; then'
}
@test 'themes base: battery_charge should exist' {
run type -a battery_charge &> /dev/null
assert_success
run battery_charge
assert_success
assert_line "0" ""
}
@test 'themes base: battery_charge should exist if battery plugin loaded' {
unset -f battery_charge
load ../../plugins/available/battery.plugin
load ../../themes/base.theme
run type -a battery_charge &> /dev/null
assert_success
run battery_charge
assert_success
run type -a battery_charge
assert_line ' no)'
}