summaryrefslogtreecommitdiff
path: root/internal/handlers/handlers_test.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-01-20 10:40:29 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-01-20 10:40:29 -1000
commit6a59098c3096f5ebd3a61ef5268cbd480b0f1519 (patch)
tree2192861ed6db801c030be9b67f05796c85bad20c /internal/handlers/handlers_test.go
parent59227d33d6e7c01fbb1ebf96ea616c5f296df7b1 (diff)
Implement efficient sync for Todoist and Trello APIs
- Add Todoist Sync API v9 support with incremental sync tokens - Store sync tokens in SQLite for persistence across restarts - Add field filtering to Trello API calls to reduce payload size - Update handlers to use incremental sync (merge changes vs full replace) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/handlers/handlers_test.go')
-rw-r--r--internal/handlers/handlers_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/internal/handlers/handlers_test.go b/internal/handlers/handlers_test.go
index 3ea2a3e..1aa72cc 100644
--- a/internal/handlers/handlers_test.go
+++ b/internal/handlers/handlers_test.go
@@ -9,6 +9,7 @@ import (
"testing"
"time"
+ "task-dashboard/internal/api"
"task-dashboard/internal/config"
"task-dashboard/internal/models"
"task-dashboard/internal/store"
@@ -82,6 +83,32 @@ func (m *mockTodoistClient) CompleteTask(ctx context.Context, taskID string) err
return nil
}
+func (m *mockTodoistClient) Sync(ctx context.Context, syncToken string) (*api.TodoistSyncResponse, error) {
+ if m.err != nil {
+ return nil, m.err
+ }
+ // Return a mock sync response with tasks converted to sync items
+ items := make([]api.SyncItemResponse, 0, len(m.tasks))
+ for _, task := range m.tasks {
+ items = append(items, api.SyncItemResponse{
+ ID: task.ID,
+ Content: task.Content,
+ Description: task.Description,
+ ProjectID: task.ProjectID,
+ Priority: task.Priority,
+ Labels: task.Labels,
+ IsCompleted: task.Completed,
+ IsDeleted: false,
+ })
+ }
+ return &api.TodoistSyncResponse{
+ SyncToken: "test-sync-token",
+ FullSync: true,
+ Items: items,
+ Projects: []api.SyncProjectResponse{},
+ }, nil
+}
+
// mockTrelloClient creates a mock Trello client for testing
type mockTrelloClient struct {
boards []models.Board