From 6e52e4916934ab740bc21c9416d5ce4061e1a132 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Tue, 10 Feb 2026 13:30:14 -0500 Subject: [PATCH] fix(tests): Remove duplicate analytics test with stale field expectations The first GetReadingStats_WithAuth_DefaultDates test was expecting 'total_books' and 'total_reading_time' fields that don't exist in the API response. The second duplicate test correctly expects 'total_books_read' and 'total_reading_time_minutes'. This resolves the TestAnalyticsReadingStats failure. --- cmd/server/tests/analytics_test.go | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/cmd/server/tests/analytics_test.go b/cmd/server/tests/analytics_test.go index 2afb1a4..ca54896 100644 --- a/cmd/server/tests/analytics_test.go +++ b/cmd/server/tests/analytics_test.go @@ -25,28 +25,6 @@ func TestAnalyticsReadingStats(t *testing.T) { assert.Equal(t, http.StatusUnauthorized, resp.StatusCode) }) - t.Run("GetReadingStats_WithAuth_DefaultDates", func(t *testing.T) { - setup := setupTestServer(t) - - token := loginTestUser(t, setup.Server, setup.DB) - - req, _ := http.NewRequest("GET", setup.Server.URL+"/api/analytics/reading-stats", nil) - req.Header.Set("Authorization", "Bearer "+token) - client := &http.Client{} - resp, err := client.Do(req) - require.NoError(t, err) - defer resp.Body.Close() - - assert.Equal(t, http.StatusOK, resp.StatusCode) - - var result map[string]interface{} - json.NewDecoder(resp.Body).Decode(&result) - assert.Contains(t, result, "total_books") - assert.Contains(t, result, "total_reading_time") - assert.Contains(t, result, "completion_rate") - assert.Contains(t, result, "daily_reading_minutes") - }) - t.Run("GetReadingStats_WithAuth_DefaultDates", func(t *testing.T) { setup := setupTestServer(t)