summaryrefslogtreecommitdiff
path: root/internal/handlers/widget_test.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-07-13 17:52:10 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-07-16 02:42:31 +0000
commitc4066f78d83b1440155248f9bc724b905aa88697 (patch)
tree70b557a1e340f12aa125fd0c53effabcbda4027b /internal/handlers/widget_test.go
parentfb41a5eb47a4213c3f9a7095da4b8741f1598725 (diff)
feat(widget): tap event to open its source directly, drop detail popup
Tapping a calendar event (or any event-type item) now opens the event's URL (Google Calendar, Plan to Eat, etc.) directly instead of showing an intermediate popup with an "Open in Calendar" button. Removes EventDetailActivity and the recurrence-schedule lookup it was the only consumer of: WidgetRepository.getRecurrence, the Go /api/widget/recurrence endpoint, HandleWidgetRecurrence, GoogleCalendarAPI.GetRecurrenceRule, and formatRecurrence, plus their tests. RecurringEventID itself stays -- it's general calendar-sync metadata used elsewhere in the timeline pipeline, not exclusive to the removed popup.
Diffstat (limited to 'internal/handlers/widget_test.go')
-rw-r--r--internal/handlers/widget_test.go47
1 files changed, 0 insertions, 47 deletions
diff --git a/internal/handlers/widget_test.go b/internal/handlers/widget_test.go
index 3116918..4e08d2a 100644
--- a/internal/handlers/widget_test.go
+++ b/internal/handlers/widget_test.go
@@ -3,7 +3,6 @@ package handlers
import (
"context"
"encoding/json"
- "fmt"
"net/http"
"net/http/httptest"
"strings"
@@ -788,49 +787,3 @@ func TestTimelineItemToWidgetItem_NonRecurring_EmptyRecurringEventID(t *testing.
}
}
-// TestHandleWidgetRecurrence_ReturnsFormattedSchedule proves the recurrence
-// lookup endpoint: given a recurring_event_id query param, it calls the
-// calendar client's GetRecurrenceRule and returns the formatted text.
-func TestHandleWidgetRecurrence_ReturnsFormattedSchedule(t *testing.T) {
- mock := &MockCalendarClient{RecurrenceRule: "Repeats weekly on Monday"}
- h := &Handler{googleCalendarClient: mock}
- req := httptest.NewRequest("GET", "/api/widget/recurrence?recurring_event_id=master-1", nil)
- w := httptest.NewRecorder()
- http.HandlerFunc(h.HandleWidgetRecurrence).ServeHTTP(w, req)
-
- if w.Code != http.StatusOK {
- t.Fatalf("expected 200, got %d", w.Code)
- }
- var resp struct {
- Recurrence string `json:"recurrence"`
- }
- if err := json.NewDecoder(w.Body).Decode(&resp); err != nil {
- t.Fatalf("failed to decode response: %v", err)
- }
- if resp.Recurrence != "Repeats weekly on Monday" {
- t.Errorf("recurrence = %q, want %q", resp.Recurrence, "Repeats weekly on Monday")
- }
-}
-
-func TestHandleWidgetRecurrence_NotFound_Returns404(t *testing.T) {
- mock := &MockCalendarClient{RecurrenceErr: fmt.Errorf("not found")}
- h := &Handler{googleCalendarClient: mock}
- req := httptest.NewRequest("GET", "/api/widget/recurrence?recurring_event_id=missing", nil)
- w := httptest.NewRecorder()
- http.HandlerFunc(h.HandleWidgetRecurrence).ServeHTTP(w, req)
-
- if w.Code != http.StatusNotFound {
- t.Fatalf("expected 404, got %d", w.Code)
- }
-}
-
-func TestHandleWidgetRecurrence_MissingParam_Returns400(t *testing.T) {
- h := &Handler{}
- req := httptest.NewRequest("GET", "/api/widget/recurrence", nil)
- w := httptest.NewRecorder()
- http.HandlerFunc(h.HandleWidgetRecurrence).ServeHTTP(w, req)
-
- if w.Code != http.StatusBadRequest {
- t.Fatalf("expected 400, got %d", w.Code)
- }
-}