summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Winter <ik@erikwinter.nl>2021-06-04 08:01:40 +0200
committerErik Winter <ik@erikwinter.nl>2021-06-04 08:01:40 +0200
commit05ad9720e1e05c0b84e677aacfa4256aeead5e38 (patch)
tree59014701c6d763878b90a555b76166a6988eeff7
parent545657edf17e9ca24470cfdc9f680b1788832fa5 (diff)
add test for parsing recurring task
-rw-r--r--internal/task/task_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/internal/task/task_test.go b/internal/task/task_test.go
index 5728c1e..c5cf571 100644
--- a/internal/task/task_test.go
+++ b/internal/task/task_test.go
@@ -15,6 +15,7 @@ func TestNewFromMessage(t *testing.T) {
action := "some action"
project := "project"
date := task.NewDate(2021, 1, 20)
+ recurs := "2021-06-04, daily"
for _, tc := range []struct {
name string
@@ -204,6 +205,31 @@ Forwarded message:
Dirty: true,
},
},
+ {
+ name: "recur takes precedence over date",
+ message: &mstore.Message{
+ Folder: task.FOLDER_INBOX,
+ Body: fmt.Sprintf(`
+action: %s
+due: no date
+recur: %s
+project: %s
+id :%s
+version: %d
+`, action, recurs, project, id, version),
+ },
+ hasId: true,
+ hasVersion: true,
+ exp: &task.Task{
+ Id: id,
+ Version: version + 1,
+ Folder: task.FOLDER_RECURRING,
+ Action: action,
+ Project: project,
+ Recur: task.Daily{Start: task.NewDate(2021, 6, 4)},
+ Dirty: true,
+ },
+ },
} {
t.Run(tc.name, func(t *testing.T) {
act := task.New(tc.message)