mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Add specs for wtf.ChecklistItem
This commit is contained in:
42
wtftests/checklist_item_test.go
Normal file
42
wtftests/checklist_item_test.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package wtftests
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
. "github.com/senorprogrammer/wtf/wtf"
|
||||
. "github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
/* -------------------- CheckMark -------------------- */
|
||||
|
||||
func TestCheckMark(t *testing.T) {
|
||||
loadConfig()
|
||||
|
||||
item := ChecklistItem{}
|
||||
Equal(t, " ", item.CheckMark())
|
||||
|
||||
item = ChecklistItem{Checked: true}
|
||||
Equal(t, "x", item.CheckMark())
|
||||
}
|
||||
|
||||
/* -------------------- Toggle -------------------- */
|
||||
|
||||
func TestToggle(t *testing.T) {
|
||||
loadConfig()
|
||||
|
||||
item := ChecklistItem{}
|
||||
Equal(t, false, item.Checked)
|
||||
|
||||
item.Toggle()
|
||||
Equal(t, true, item.Checked)
|
||||
|
||||
item.Toggle()
|
||||
Equal(t, false, item.Checked)
|
||||
}
|
||||
|
||||
/* -------------------- helpers -------------------- */
|
||||
|
||||
func loadConfig() {
|
||||
Config, _ = config.ParseYamlFile("../_sample_configs/simple_config.yml")
|
||||
}
|
||||
Reference in New Issue
Block a user