gte/internal/process/new_test.go

29 lines
715 B
Go
Raw Normal View History

2021-09-04 12:20:35 +02:00
package process_test
import (
"testing"
2024-03-08 09:20:40 +01:00
"code.ewintr.nl/go-kit/test"
"code.ewintr.nl/gte/internal/process"
"code.ewintr.nl/gte/internal/storage"
"code.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)
}