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"),