2021-09-04 12:20:35 +02:00
|
|
|
package process_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2021-09-19 11:59:26 +02:00
|
|
|
"ewintr.nl/go-kit/test"
|
|
|
|
"ewintr.nl/gte/internal/process"
|
|
|
|
"ewintr.nl/gte/internal/storage"
|
|
|
|
"ewintr.nl/gte/internal/task"
|
2021-09-04 12:20:35 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestNew(t *testing.T) {
|
|
|
|
local := storage.NewMemory()
|
|
|
|
update := &task.LocalUpdate{
|
|
|
|
Fields: []string{task.FIELD_ACTION, task.FIELD_PROJECT, task.FIELD_DUE},
|
|
|
|
Project: "project",
|
|
|
|
Action: "action",
|
|
|
|
Due: task.NewDate(2021, 9, 4),
|
|
|
|
}
|
|
|
|
n := process.NewNew(local, update)
|
|
|
|
test.OK(t, n.Process())
|
|
|
|
tasks, err := local.FindAll()
|
|
|
|
test.OK(t, err)
|
|
|
|
test.Assert(t, len(tasks) == 1, "amount of tasks was not 1")
|
|
|
|
tsk := tasks[0]
|
|
|
|
test.Assert(t, tsk.Id != "", "id was empty")
|
|
|
|
test.Equals(t, update, tsk.LocalUpdate)
|
|
|
|
}
|