kevinschoon-pomo/task_test.go

37 lines
536 B
Go
Raw Normal View History

2018-01-26 16:07:38 +01:00
package main
import (
"fmt"
"io/ioutil"
"testing"
"time"
)
func TestTaskRunner(t *testing.T) {
path, _ := ioutil.TempDir("/tmp", "")
store, err := NewStore(path)
if err != nil {
t.Error(err)
}
err = initDB(store)
if err != nil {
t.Error(err)
}
runner, err := NewTaskRunner(&Task{
Duration: time.Second * 2,
NPomodoros: 2,
Message: fmt.Sprint("Test Task"),
2018-01-27 17:42:13 +01:00
}, store, NoopNotifier{})
2018-01-26 16:07:38 +01:00
if err != nil {
t.Error(err)
}
runner.Start()
runner.Toggle()
runner.Toggle()
runner.Toggle()
runner.Toggle()
}