summaryrefslogtreecommitdiff
path: root/test/acceptance_test.go
diff options
context:
space:
mode:
authorDoot Agent <agent@doot.local>2026-07-06 00:00:59 +0000
committerDoot Agent <agent@doot.local>2026-07-06 00:00:59 +0000
commit945c34590677e161a711ccaff0e1077197b1b178 (patch)
treedf26e8ba5a369b3323649c2fab95bd8e7a49b58e /test/acceptance_test.go
parentcd14604bbef17f696475cf8737f1e41c9fa2dd06 (diff)
feat: remove Todoist integration entirely
Native tasks (native_tasks table) fully replace Todoist. All Todoist API code, store functions, handlers, routes, templates, and tests have been removed. Migration 021 drops the now-unused tasks cache table. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'test/acceptance_test.go')
-rw-r--r--test/acceptance_test.go81
1 files changed, 4 insertions, 77 deletions
diff --git a/test/acceptance_test.go b/test/acceptance_test.go
index d4a386b..e1710bd 100644
--- a/test/acceptance_test.go
+++ b/test/acceptance_test.go
@@ -73,7 +73,6 @@ func setupTestServer(t *testing.T) (*httptest.Server, *store.Store, *http.Client
_ = authService.EnsureDefaultUser("admin", "password")
// Create mock API clients
- todoistClient := api.NewTodoistClient("test_key")
trelloClient := api.NewTrelloClient("test_key", "test_token")
cfg := &config.Config{
@@ -82,7 +81,7 @@ func setupTestServer(t *testing.T) (*httptest.Server, *store.Store, *http.Client
}
// Initialize handlers
- h := handlers.New(db, todoistClient, trelloClient, nil, nil, nil, nil, cfg, "test", false)
+ h := handlers.New(db, trelloClient, nil, nil, nil, nil, cfg, "test", false)
// Set up router (same as main.go)
r := chi.NewRouter()
@@ -103,7 +102,6 @@ func setupTestServer(t *testing.T) (*httptest.Server, *store.Store, *http.Client
r.Get("/", h.HandleDashboard)
r.Post("/api/refresh", h.HandleRefresh)
- r.Get("/api/tasks", h.HandleGetTasks)
r.Get("/api/meals", h.HandleGetMeals)
r.Get("/api/boards", h.HandleGetBoards)
})
@@ -139,21 +137,6 @@ func TestFullWorkflow(t *testing.T) {
_ = resp.Body.Close()
// Seed database with test data
- testTasks := []models.Task{
- {
- ID: "task1",
- Content: "Buy groceries",
- Description: "Milk, eggs, bread",
- ProjectID: "proj1",
- ProjectName: "Personal",
- Priority: 1,
- Completed: false,
- Labels: []string{"shopping"},
- URL: "https://todoist.com/task/1",
- CreatedAt: time.Now(),
- },
- }
-
testBoards := []models.Board{
{
ID: "board1",
@@ -170,41 +153,11 @@ func TestFullWorkflow(t *testing.T) {
},
}
- if err := db.SaveTasks(testTasks); err != nil {
- t.Fatalf("Failed to seed tasks: %v", err)
- }
-
if err := db.SaveBoards(testBoards); err != nil {
t.Fatalf("Failed to seed boards: %v", err)
}
- // Test 1: GET /api/tasks
- t.Run("GetTasks", func(t *testing.T) {
- resp, err := client.Get(server.URL + "/api/tasks")
- if err != nil {
- t.Fatalf("Failed to get tasks: %v", err)
- }
- defer func() { _ = resp.Body.Close() }()
-
- if resp.StatusCode != http.StatusOK {
- t.Errorf("Expected status 200, got %d", resp.StatusCode)
- }
-
- var tasks []models.Task
- if err := json.NewDecoder(resp.Body).Decode(&tasks); err != nil {
- t.Fatalf("Failed to decode tasks: %v", err)
- }
-
- if len(tasks) != 1 {
- t.Errorf("Expected 1 task, got %d", len(tasks))
- }
-
- if tasks[0].Content != "Buy groceries" {
- t.Errorf("Expected task content 'Buy groceries', got '%s'", tasks[0].Content)
- }
- })
-
- // Test 2: GET /api/boards
+ // Test 1: GET /api/boards
t.Run("GetBoards", func(t *testing.T) {
resp, err := client.Get(server.URL + "/api/boards")
if err != nil {
@@ -285,39 +238,13 @@ func TestFullWorkflow(t *testing.T) {
// TestCaching tests the caching behavior
func TestCaching(t *testing.T) {
- server, db, client, cleanup := setupTestServer(t)
+ server, _, client, cleanup := setupTestServer(t)
defer cleanup()
// Login
_, _ = client.Get(server.URL + "/test/login")
- // Seed initial data
- testTasks := []models.Task{
- {
- ID: "task1",
- Content: "Initial task",
- },
- }
- _ = db.SaveTasks(testTasks)
- _ = db.UpdateCacheMetadata("todoist_tasks", 5)
-
- // Test 1: First request should use cache
- t.Run("UsesCache", func(t *testing.T) {
- resp, err := client.Get(server.URL + "/api/tasks")
- if err != nil {
- t.Fatalf("Failed to get tasks: %v", err)
- }
- defer func() { _ = resp.Body.Close() }()
-
- var tasks []models.Task
- _ = json.NewDecoder(resp.Body).Decode(&tasks)
-
- if len(tasks) != 1 {
- t.Errorf("Expected 1 task from cache, got %d", len(tasks))
- }
- })
-
- // Test 2: Refresh should invalidate cache
+ // Test: Refresh should invalidate cache
t.Run("RefreshInvalidatesCache", func(t *testing.T) {
// Force refresh
resp, err := client.Post(server.URL+"/api/refresh", "application/json", nil)