rename to tasks
This commit is contained in:
parent
3b74c5eeb5
commit
e4faf75aeb
|
@ -43,9 +43,9 @@ func TestDelete(t *testing.T) {
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
eventRepo := memory.NewTask()
|
taskRepo := memory.NewTask()
|
||||||
syncRepo := memory.NewSync()
|
syncRepo := memory.NewSync()
|
||||||
if err := eventRepo.Store(e); err != nil {
|
if err := taskRepo.Store(e); err != nil {
|
||||||
t.Errorf("exp nil, got %v", err)
|
t.Errorf("exp nil, got %v", err)
|
||||||
}
|
}
|
||||||
localRepo := memory.NewLocalID()
|
localRepo := memory.NewLocalID()
|
||||||
|
@ -53,7 +53,7 @@ func TestDelete(t *testing.T) {
|
||||||
t.Errorf("exp nil, got %v", err)
|
t.Errorf("exp nil, got %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := command.NewDelete(localRepo, eventRepo, syncRepo)
|
cmd := command.NewDelete(localRepo, taskRepo, syncRepo)
|
||||||
|
|
||||||
actErr := cmd.Execute(tc.main, tc.flags) != nil
|
actErr := cmd.Execute(tc.main, tc.flags) != nil
|
||||||
if tc.expErr != actErr {
|
if tc.expErr != actErr {
|
||||||
|
@ -63,7 +63,7 @@ func TestDelete(t *testing.T) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_, repoErr := eventRepo.Find(e.ID)
|
_, repoErr := taskRepo.Find(e.ID)
|
||||||
if !errors.Is(repoErr, storage.ErrNotFound) {
|
if !errors.Is(repoErr, storage.ErrNotFound) {
|
||||||
t.Errorf("exp %v, got %v", storage.ErrNotFound, actErr)
|
t.Errorf("exp %v, got %v", storage.ErrNotFound, actErr)
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,8 @@ func (t *Task) FindAll() ([]item.Task, error) {
|
||||||
defer t.mutex.RUnlock()
|
defer t.mutex.RUnlock()
|
||||||
|
|
||||||
tasks := make([]item.Task, 0, len(t.tasks))
|
tasks := make([]item.Task, 0, len(t.tasks))
|
||||||
for _, event := range t.tasks {
|
for _, tsk := range t.tasks {
|
||||||
tasks = append(tasks, event)
|
tasks = append(tasks, tsk)
|
||||||
}
|
}
|
||||||
sort.Slice(tasks, func(i, j int) bool {
|
sort.Slice(tasks, func(i, j int) bool {
|
||||||
return tasks[i].ID < tasks[j].ID
|
return tasks[i].ID < tasks[j].ID
|
||||||
|
|
Loading…
Reference in New Issue