From ef28b2788ba5d269ce11649f0428afe8f727b6cb Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Wed, 18 Oct 2017 17:30:52 +0200 Subject: [PATCH] Added test cases for battery_percentage with pmset Need to figure out way to ensure that pmset is used every time... --- test/plugins/battery.plugin.bats | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test/plugins/battery.plugin.bats diff --git a/test/plugins/battery.plugin.bats b/test/plugins/battery.plugin.bats new file mode 100644 index 00000000..c6f62c92 --- /dev/null +++ b/test/plugins/battery.plugin.bats @@ -0,0 +1,36 @@ +#!/usr/bin/env bats + +load ../test_helper +load ../../lib/composure + +cite _about _param _example _group _author _version + +load ../../lib/helpers +load ../../plugins/available/battery.plugin + +@test 'plugins battery: battery-percentage with pmset, 100%' { + function pmset { + echo "-InternalBattery-0 (id=12345) 100%; discharging; 16:00 remaining present: true" + } + + run battery_percentage + assert_output "100" +} + +@test 'plugins battery: battery-percentage with pmset, 98%' { + function pmset { + echo "-InternalBattery-0 (id=12345) 98%; discharging; 16:00 remaining present: true" + } + + run battery_percentage + assert_output "98" +} + +@test 'plugins battery: battery-percentage with pmset, 4%' { + function pmset { + echo "-InternalBattery-0 (id=12345) 4%; discharging; 16:00 remaining present: true" + } + + run battery_percentage + assert_output "4" +}