From 18b619c7a128465df7433538c38ff8214326c55c Mon Sep 17 00:00:00 2001 From: strogiyotec Date: Sat, 5 Sep 2020 20:49:42 -0700 Subject: [PATCH] fix runner test --- runner.go | 15 +++++++++++++++ runner_test.go | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/runner.go b/runner.go index f8cbadf..c6376e1 100644 --- a/runner.go +++ b/runner.go @@ -20,6 +20,21 @@ type TaskRunner struct { duration time.Duration } +func NewMockedTaskRunner(task *Task, store *Store, notifier Notifier) (*TaskRunner, error) { + tr := &TaskRunner{ + taskID: task.ID, + taskMessage: task.Message, + nPomodoros: task.NPomodoros, + origDuration: task.Duration, + store: store, + state: State(0), + pause: make(chan bool), + toggle: make(chan bool), + notifier: notifier, + duration: task.Duration, + } + return tr, nil +} func NewTaskRunner(task *Task, config *Config) (*TaskRunner, error) { store, err := NewStore(config.DBPath) if err != nil { diff --git a/runner_test.go b/runner_test.go index ca1b6f3..b11c628 100644 --- a/runner_test.go +++ b/runner_test.go @@ -18,7 +18,7 @@ func TestTaskRunner(t *testing.T) { if err != nil { t.Error(err) } - runner, err := NewTaskRunner(&Task{ + runner, err := NewMockedTaskRunner(&Task{ Duration: time.Second * 2, NPomodoros: 2, Message: fmt.Sprint("Test Task"),