Commit graph

6 commits

Author SHA1 Message Date
8c9f888927 Fix DueDate parsing to support Checkvist API slash format
The Checkvist API returns due dates in slash format (2026/01/15),
but parseDueDate() only supported ISO format with dashes.

- Extend parseDueDate() to try both formats (slashes and dashes)
- Add test case for Checkvist API format parsing
- Fix TestTaskBuilder to use existing DueTomorrow constant

Closes checkvist-api-otm
2026-01-15 09:29:34 +01:00
773da6323d gofmt 2026-01-14 21:24:46 +01:00
895b76d9e1 Fix TaskBuilder parameters not sent to API
- Add createTaskWrapper and updateTaskWrapper structs to wrap request
  bodies in nested JSON format expected by Checkvist API
- Change JSON tag from "due" to "due_date" as required by API
- Update DueDate constants to use valid Checkvist smart syntax values
  (^Today, ^Tomorrow, ^ASAP, ^Monday)
- Update tests to verify nested format and correct field names

Fixes checkvist-api-a5b
2026-01-14 19:02:34 +01:00
762b4daf8d Add tests documenting TaskBuilder parameters bug 2026-01-14 18:23:17 +01:00
e4862b8e9b Fix date parsing for Checkvist API format
Add custom APITime type with UnmarshalJSON to handle the non-standard
date format returned by the Checkvist API ("2026/01/14 16:07:31 +0000")
instead of the expected RFC3339 format.

Changes:
- Add APITime type with custom JSON marshaling/unmarshaling in models.go
- Replace time.Time with APITime for UpdatedAt/CreatedAt fields in
  Checklist, Task, and Note structs
- Add NewAPITime constructor for convenience
- Update test fixtures to use real API date format
- Add comprehensive unit tests for APITime in models_test.go

Fixes: checkvist-api-4qn
2026-01-14 18:10:02 +01:00
e2d0f2299c 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
2026-01-14 13:46:08 +01:00