fix runner test

This commit is contained in:
strogiyotec 2020-09-05 20:49:42 -07:00
parent e3732717f5
commit 18b619c7a1
2 changed files with 16 additions and 1 deletions

View File

@ -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 {

View File

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