summaryrefslogtreecommitdiff
path: root/internal/handlers/agent_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/handlers/agent_test.go')
-rw-r--r--internal/handlers/agent_test.go26
1 files changed, 11 insertions, 15 deletions
diff --git a/internal/handlers/agent_test.go b/internal/handlers/agent_test.go
index eab1609..2893a13 100644
--- a/internal/handlers/agent_test.go
+++ b/internal/handlers/agent_test.go
@@ -746,13 +746,11 @@ func TestHandleAgentTaskWriteOperations(t *testing.T) {
defer cleanup()
// Mock clients
- mockTodoist := &mockTodoistClient{}
mockTrello := &mockTrelloClient{}
h := &Handler{
- store: db,
- todoistClient: mockTodoist,
- trelloClient: mockTrello,
- config: &config.Config{},
+ store: db,
+ trelloClient: mockTrello,
+ config: &config.Config{},
}
// Create an approved session
@@ -766,11 +764,11 @@ func TestHandleAgentTaskWriteOperations(t *testing.T) {
db.CreateAgentSession(session)
db.ApproveAgentSession("write-request-token", sessionToken, time.Now().Add(1*time.Hour))
- // Pre-populate store with a task to get details during completion
- db.SaveTasks([]models.Task{{ID: "task123", Content: "Test Task"}})
+ // Pre-populate store with a native task
+ _ = db.CreateNativeTask(models.Task{ID: "task123", Content: "Test Task"})
t.Run("complete task", func(t *testing.T) {
- req := httptest.NewRequest(http.MethodPost, "/agent/tasks/task123/complete?source=todoist", nil)
+ req := httptest.NewRequest(http.MethodPost, "/agent/tasks/task123/complete?source=doot", nil)
w := httptest.NewRecorder()
// Manually inject session into context as middleware would
@@ -804,7 +802,7 @@ func TestHandleAgentTaskWriteOperations(t *testing.T) {
t.Run("update due date", func(t *testing.T) {
due := time.Now().Add(24 * time.Hour)
body, _ := json.Marshal(map[string]*time.Time{"due": &due})
- req := httptest.NewRequest(http.MethodPatch, "/agent/tasks/task123/due?source=todoist", bytes.NewReader(body))
+ req := httptest.NewRequest(http.MethodPatch, "/agent/tasks/task123/due?source=doot", bytes.NewReader(body))
w := httptest.NewRecorder()
rctx := chi.NewRouteContext()
@@ -820,7 +818,7 @@ func TestHandleAgentTaskWriteOperations(t *testing.T) {
t.Run("update task details", func(t *testing.T) {
body, _ := json.Marshal(map[string]string{"title": "Updated Title", "description": "New Desc"})
- req := httptest.NewRequest(http.MethodPatch, "/agent/tasks/task123?source=todoist", bytes.NewReader(body))
+ req := httptest.NewRequest(http.MethodPatch, "/agent/tasks/task123?source=doot", bytes.NewReader(body))
w := httptest.NewRecorder()
rctx := chi.NewRouteContext()
@@ -839,17 +837,15 @@ func TestHandleAgentCreateOperations(t *testing.T) {
db, cleanup := setupTestDB(t)
defer cleanup()
- mockTodoist := &mockTodoistClient{}
h := &Handler{
- store: db,
- todoistClient: mockTodoist,
- config: &config.Config{},
+ store: db,
+ config: &config.Config{},
}
t.Run("create task", func(t *testing.T) {
body, _ := json.Marshal(map[string]string{
"title": "New Agent Task",
- "source": "todoist",
+ "source": "doot",
})
req := httptest.NewRequest(http.MethodPost, "/agent/tasks", bytes.NewReader(body))
w := httptest.NewRecorder()