kevinschoon-pomo/runner_test.go

38 lines
572 B
Go
Raw Normal View History

2018-01-26 16:07:38 +01:00
package main
import (
"fmt"
"io/ioutil"
"path"
2018-01-26 16:07:38 +01:00
"testing"
"time"
)
func TestTaskRunner(t *testing.T) {
baseDir, _ := ioutil.TempDir("/tmp", "")
store, err := NewStore(path.Join(baseDir, "pomo.db"))
2018-01-26 16:07:38 +01:00
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()
}