forked from Mirrors/bubbletea
test: cmds
Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
parent
7934b60e21
commit
cfb871c5ca
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue