summaryrefslogtreecommitdiff
path: root/internal/handlers/timeline_logic_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/handlers/timeline_logic_test.go')
-rw-r--r--internal/handlers/timeline_logic_test.go21
1 files changed, 16 insertions, 5 deletions
diff --git a/internal/handlers/timeline_logic_test.go b/internal/handlers/timeline_logic_test.go
index 8104a96..d6959da 100644
--- a/internal/handlers/timeline_logic_test.go
+++ b/internal/handlers/timeline_logic_test.go
@@ -90,6 +90,17 @@ func setupTestStore(t *testing.T) *store.Store {
html_link TEXT,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
+ CREATE TABLE IF NOT EXISTS google_tasks (
+ id TEXT PRIMARY KEY,
+ title TEXT NOT NULL,
+ notes TEXT,
+ status TEXT NOT NULL,
+ completed BOOLEAN NOT NULL DEFAULT 0,
+ due_date DATETIME,
+ updated_at DATETIME,
+ list_id TEXT NOT NULL,
+ url TEXT
+ );
`
if err := os.WriteFile(filepath.Join(migrationDir, "001_init.sql"), []byte(schema), 0644); err != nil {
t.Fatalf("Failed to write migration file: %v", err)
@@ -143,7 +154,7 @@ func TestBuildTimeline(t *testing.T) {
start := time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC)
end := time.Date(2023, 1, 2, 0, 0, 0, 0, time.UTC)
- items, err := BuildTimeline(context.Background(), s, nil, start, end)
+ items, err := BuildTimeline(context.Background(), s, start, end)
if err != nil {
t.Fatalf("BuildTimeline failed: %v", err)
}
@@ -277,7 +288,7 @@ func TestBuildTimeline_IncludesOverdueItems(t *testing.T) {
// Query range: today through tomorrow
end := today.AddDate(0, 0, 1)
- items, err := BuildTimeline(context.Background(), s, nil,today, end)
+ items, err := BuildTimeline(context.Background(), s, today, end)
if err != nil {
t.Fatalf("BuildTimeline failed: %v", err)
}
@@ -320,7 +331,7 @@ func TestBuildTimeline_ExcludesCompletedOverdue(t *testing.T) {
{ID: "done1", Content: "Done overdue", DueDate: &yesterday, Completed: true},
})
- items, err := BuildTimeline(context.Background(), s, nil,today, end)
+ items, err := BuildTimeline(context.Background(), s, today, end)
if err != nil {
t.Fatalf("BuildTimeline failed: %v", err)
}
@@ -348,7 +359,7 @@ func TestBuildTimeline_ReadsCalendarEventsFromStore(t *testing.T) {
}
// Call BuildTimeline with NO calendar client (nil) — events should come from store
- items, err := BuildTimeline(context.Background(), s, nil,start, end)
+ items, err := BuildTimeline(context.Background(), s, start, end)
if err != nil {
t.Fatalf("BuildTimeline failed: %v", err)
}
@@ -473,7 +484,7 @@ func TestBuildTimeline_IncludesUndatedTodoistTasks(t *testing.T) {
start := time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC)
end := time.Date(2023, 1, 2, 0, 0, 0, 0, time.UTC)
- items, err := BuildTimeline(context.Background(), s, nil, start, end)
+ items, err := BuildTimeline(context.Background(), s, start, end)
if err != nil {
t.Fatalf("BuildTimeline failed: %v", err)
}