diff --git a/commands_test.go b/commands_test.go index 2a11fbc..779b2d9 100644 --- a/commands_test.go +++ b/commands_test.go @@ -3,8 +3,29 @@ package tea import ( "fmt" "testing" + "time" ) +func TestEvery(t *testing.T) { + expected := "every ms" + msg := Every(time.Millisecond, func(t time.Time) Msg { + return expected + })() + if expected != msg { + t.Fatalf("expected a msg %v but got %v", expected, msg) + } +} + +func TestTick(t *testing.T) { + expected := "tick" + msg := Tick(time.Millisecond, func(t time.Time) Msg { + return expected + })() + if expected != msg { + t.Fatalf("expected a msg %v but got %v", expected, msg) + } +} + func TestSequentially(t *testing.T) { var expectedErrMsg = fmt.Errorf("some err") var expectedStrMsg = "some msg"