mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Simplify ChecklistItem tests
This commit is contained in:
parent
b0c175dd57
commit
e1ad1f3065
36
checklist/checklist_item_test.go
Normal file
36
checklist/checklist_item_test.go
Normal file
@ -0,0 +1,36 @@
|
||||
package checklist
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func testChecklistItem() *ChecklistItem {
|
||||
item := NewChecklistItem(
|
||||
false,
|
||||
"test",
|
||||
"x",
|
||||
" ",
|
||||
)
|
||||
return item
|
||||
}
|
||||
|
||||
func Test_CheckMark(t *testing.T) {
|
||||
item := testChecklistItem()
|
||||
Equal(t, " ", item.CheckMark())
|
||||
|
||||
item.Toggle()
|
||||
Equal(t, "x", item.CheckMark())
|
||||
}
|
||||
|
||||
func Test_Toggle(t *testing.T) {
|
||||
item := testChecklistItem()
|
||||
Equal(t, false, item.Checked)
|
||||
|
||||
item.Toggle()
|
||||
Equal(t, true, item.Checked)
|
||||
|
||||
item.Toggle()
|
||||
Equal(t, false, item.Checked)
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package wtftests
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/stretchr/testify/assert"
|
||||
. "github.com/wtfutil/wtf/checklist"
|
||||
)
|
||||
|
||||
/* -------------------- CheckMark -------------------- */
|
||||
|
||||
func TestCheckMark(t *testing.T) {
|
||||
item := ChecklistItem{}
|
||||
Equal(t, " ", item.CheckMark())
|
||||
|
||||
item = ChecklistItem{Checked: true}
|
||||
Equal(t, "x", item.CheckMark())
|
||||
}
|
||||
|
||||
/* -------------------- Toggle -------------------- */
|
||||
|
||||
func TestToggle(t *testing.T) {
|
||||
item := ChecklistItem{}
|
||||
Equal(t, false, item.Checked)
|
||||
|
||||
item.Toggle()
|
||||
Equal(t, true, item.Checked)
|
||||
|
||||
item.Toggle()
|
||||
Equal(t, false, item.Checked)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user