From 23c670442392af1c75b935b3296ae2fc4fd094ba Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Mon, 23 Mar 2026 08:59:35 +0000 Subject: fix: support multiple enabled Google Task lists and Calendars - Update Google API interfaces with setters for list/calendar IDs - Update fetchCalendarEvents and fetchGoogleTasks to use enabled IDs from source_configs - Update timeline logic tests to reflect interface changes and seed config data - Ensure dashboard respects user-selected lists from settings --- internal/handlers/timeline_logic_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'internal/handlers/timeline_logic_test.go') diff --git a/internal/handlers/timeline_logic_test.go b/internal/handlers/timeline_logic_test.go index d6959da..03bc291 100644 --- a/internal/handlers/timeline_logic_test.go +++ b/internal/handlers/timeline_logic_test.go @@ -33,6 +33,8 @@ func (m *MockCalendarClient) GetCalendarList(ctx context.Context) ([]models.Cale return nil, m.Err } +func (m *MockCalendarClient) SetCalendarIDs(ids []string) {} + func setupTestStore(t *testing.T) *store.Store { t.Helper() tempDir := t.TempDir() @@ -398,6 +400,14 @@ func TestFetchCalendarEvents_CacheFallbackOnAPIError(t *testing.T) { t.Fatalf("Failed to update cache metadata: %v", err) } + // Enable the calendar in config + err = db.SyncSourceConfigs("gcal", "calendar", []models.SourceConfig{ + {Source: "gcal", ItemType: "calendar", ItemID: "e-cached", ItemName: "Cached", Enabled: true}, + }) + if err != nil { + t.Fatalf("Failed to seed calendar config: %v", err) + } + // Create handler with a failing calendar client failingCal := &MockCalendarClient{Err: fmt.Errorf("API unavailable")} h := &Handler{ -- cgit v1.2.3