Author: strogiyotec [almas337519@gmail.com]
Hash: 18b619c7a128465df7433538c38ff8214326c55c
Timestamp: Sun, 06 Sep 2020 03:49:42 +0000 (4 years ago)

+16 -1 +/-2 browse
fix runner test
1diff --git a/runner.go b/runner.go
2index f8cbadf..c6376e1 100644
3--- a/runner.go
4+++ b/runner.go
5 @@ -20,6 +20,21 @@ type TaskRunner struct {
6 duration time.Duration
7 }
8
9+ func NewMockedTaskRunner(task *Task, store *Store, notifier Notifier) (*TaskRunner, error) {
10+ tr := &TaskRunner{
11+ taskID: task.ID,
12+ taskMessage: task.Message,
13+ nPomodoros: task.NPomodoros,
14+ origDuration: task.Duration,
15+ store: store,
16+ state: State(0),
17+ pause: make(chan bool),
18+ toggle: make(chan bool),
19+ notifier: notifier,
20+ duration: task.Duration,
21+ }
22+ return tr, nil
23+ }
24 func NewTaskRunner(task *Task, config *Config) (*TaskRunner, error) {
25 store, err := NewStore(config.DBPath)
26 if err != nil {
27 diff --git a/runner_test.go b/runner_test.go
28index ca1b6f3..b11c628 100644
29--- a/runner_test.go
30+++ b/runner_test.go
31 @@ -18,7 +18,7 @@ func TestTaskRunner(t *testing.T) {
32 if err != nil {
33 t.Error(err)
34 }
35- runner, err := NewTaskRunner(&Task{
36+ runner, err := NewMockedTaskRunner(&Task{
37 Duration: time.Second * 2,
38 NPomodoros: 2,
39 Message: fmt.Sprint("Test Task"),