summaryrefslogtreecommitdiff
path: root/internal/handlers/timeline.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-02-03 15:15:07 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-02-03 15:15:07 -1000
commit9f35f7149d8fb790bbe8e4f0ee74f895aea1fc58 (patch)
tree5faa41878609a5c9c332b794a85300090d65bec5 /internal/handlers/timeline.go
parentf10044eac1997537bcdf7699f5b4284aac16f8e2 (diff)
Refactor template rendering with Renderer interface for testability
Introduce a Renderer interface to abstract template rendering, enabling tests to use MockRenderer instead of requiring real template files. Changes: - Add renderer.go with Renderer interface, TemplateRenderer, and MockRenderer - Update Handler struct to use Renderer instead of *template.Template - Update HTMLResponse() to accept Renderer interface - Replace all h.templates.ExecuteTemplate() calls with h.renderer.Render() - Update all tests to use MockRenderer, removing template file dependencies This eliminates 15+ tests that previously skipped with "Templates not available" and improves test isolation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/handlers/timeline.go')
-rw-r--r--internal/handlers/timeline.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/handlers/timeline.go b/internal/handlers/timeline.go
index fa5bcec..29b156a 100644
--- a/internal/handlers/timeline.go
+++ b/internal/handlers/timeline.go
@@ -109,7 +109,7 @@ func (h *Handler) HandleTimeline(w http.ResponseWriter, r *http.Request) {
data.TomorrowHours = append(data.TomorrowHours, h)
}
- HTMLResponse(w, h.templates, "timeline-tab", data)
+ HTMLResponse(w, h.renderer, "timeline-tab", data)
}
// calcCalendarBounds returns start/end hours for calendar view based on timed events.