kevinschoon-pomo/pkg/internal/runner_test.go

38 lines
578 B
Go
Raw Permalink Normal View History

2020-09-08 18:35:47 +02:00
package pomo
2018-01-26 16:07:38 +01:00
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)
}
2020-09-08 18:35:47 +02:00
err = InitDB(store)
2018-01-26 16:07:38 +01:00
if err != nil {
t.Error(err)
}
2020-09-06 05:49:42 +02:00
runner, err := NewMockedTaskRunner(&Task{
2018-01-26 16:07:38 +01:00
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()
}