Add unit tests for Tasks

Create tasks_test.go with comprehensive tests:
- TestTasks_List: list all tasks in checklist
- TestTasks_Get: get single task by ID
- TestTasks_Create: create basic task
- TestTasks_Create_WithBuilder: create task with all options
- TestTasks_Update: update task properties
- TestTasks_Delete: delete task
- TestTasks_Close: mark task as completed
- TestTasks_Reopen: reopen closed task
- TestTasks_Invalidate: invalidate task
- TestDueDate_Parsing: table-driven due date parsing tests
- TestTaskBuilder: builder pattern validation

Add testdata/tasks/ fixtures:
- list.json: sample task list
- single.json: single task response

All 11 tests pass using httptest.Server mocking.

Closes checkvist-api-v2f
This commit is contained in:
Oliver Jakoubek 2026-01-14 13:46:08 +01:00
commit e2d0f2299c
4 changed files with 487 additions and 1 deletions

34
testdata/tasks/list.json vendored Normal file
View file

@ -0,0 +1,34 @@
[
{
"id": 101,
"checklist_id": 1,
"parent_id": 0,
"content": "First task",
"status": 0,
"position": 1,
"priority": 0,
"tags_as_text": "",
"due": "2026-01-20",
"assignee_ids": [],
"comments_count": 0,
"update_line": "",
"updated_at": "2026-01-14T10:00:00Z",
"created_at": "2026-01-10T09:00:00Z"
},
{
"id": 102,
"checklist_id": 1,
"parent_id": 0,
"content": "Second task",
"status": 1,
"position": 2,
"priority": 1,
"tags_as_text": "important, urgent",
"due": "",
"assignee_ids": [1, 2],
"comments_count": 3,
"update_line": "",
"updated_at": "2026-01-14T11:00:00Z",
"created_at": "2026-01-11T10:00:00Z"
}
]

16
testdata/tasks/single.json vendored Normal file
View file

@ -0,0 +1,16 @@
{
"id": 101,
"checklist_id": 1,
"parent_id": 0,
"content": "First task",
"status": 0,
"position": 1,
"priority": 0,
"tags_as_text": "",
"due": "2026-01-20",
"assignee_ids": [],
"comments_count": 0,
"update_line": "",
"updated_at": "2026-01-14T10:00:00Z",
"created_at": "2026-01-10T09:00:00Z"
}