fix runner test
This commit is contained in:
parent
e3732717f5
commit
18b619c7a1
15
runner.go
15
runner.go
|
@ -20,6 +20,21 @@ type TaskRunner struct {
|
||||||
duration time.Duration
|
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) {
|
func NewTaskRunner(task *Task, config *Config) (*TaskRunner, error) {
|
||||||
store, err := NewStore(config.DBPath)
|
store, err := NewStore(config.DBPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -18,7 +18,7 @@ func TestTaskRunner(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
runner, err := NewTaskRunner(&Task{
|
runner, err := NewMockedTaskRunner(&Task{
|
||||||
Duration: time.Second * 2,
|
Duration: time.Second * 2,
|
||||||
NPomodoros: 2,
|
NPomodoros: 2,
|
||||||
Message: fmt.Sprint("Test Task"),
|
Message: fmt.Sprint("Test Task"),
|
||||||
|
|
Loading…
Reference in New Issue