Commit graph

5 commits

Author SHA1 Message Date
2f44308d42 Add unit tests for Notes
Create notes_test.go with tests:
- TestNotes_List: list all notes on a task
- TestNotes_Create: create new note
- TestNotes_Update: update note comment
- TestNotes_Delete: delete note

Add testdata/notes/ fixtures:
- list.json: sample notes list

All 4 tests pass using httptest.Server mocking.

Closes checkvist-api-bbx
2026-01-14 13:47:23 +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
0bb7d2d735 Add unit tests for Checklists
Create checklists_test.go with comprehensive tests:
- TestChecklists_List: list all checklists
- TestChecklists_ListArchived: list with archived filter
- TestChecklists_Get: get single checklist by ID
- TestChecklists_Get_NotFound: handle 404 error
- TestChecklists_Create: create new checklist
- TestChecklists_Update: update checklist name
- TestChecklists_Delete: delete checklist

Add testdata/checklists/ fixtures:
- list.json: sample checklist list
- list_archived.json: archived checklists
- single.json: single checklist response

All 7 tests pass using httptest.Server mocking.

Closes checkvist-api-347
2026-01-14 13:42:05 +01:00
15cf18e2d8 Add unit tests for Client and Auth
Create client_test.go with comprehensive tests using httptest.Server:
- TestNewClient_Defaults: verify default configuration
- TestNewClient_WithOptions: test functional options
- TestAuthenticate_Success: successful authentication flow
- TestAuthenticate_InvalidCredentials: 401 error handling
- TestAuthenticate_2FA: 2FA token support
- TestTokenRefresh_Auto: automatic token refresh on expiry
- TestTokenRefresh_Manual: manual token refresh
- TestCurrentUser: get current user information
- TestRetryLogic_429: retry on rate limiting
- TestRetryLogic_5xx: retry on server errors
- TestRetryLogic_ExhaustedRetries: max retries exceeded
- TestRetryLogic_ContextCancellation: respect context cancellation
- TestCalculateRetryDelay: exponential backoff calculation
- TestDefaultRetryConfig: verify default retry settings

Add testdata/auth/ fixtures:
- login_success.json
- current_user.json

All 14 tests pass.

Closes checkvist-api-8bn
2026-01-14 13:35:44 +01:00
3b076836d3 Initial commit 2026-01-14 12:42:00 +01:00