From 06985474d09eb1fc0981cd35f2c53a244481f791 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Fri, 1 May 2026 16:59:49 -0400 Subject: [PATCH] fix(tests): correct date format in analytics reading stats tests The GetReadingStats handler expects dates in MM-DD-YYYY format (01-02-2006) but the tests were sending YYYY-MM-DD (2006-01-02), causing 400 errors on the GetReadingStats_WithCustomDateRange and ReadingStats_FutureDateRange test cases. Updated both test functions to use the matching format. --- cmd/server/tests/analytics_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/server/tests/analytics_test.go b/cmd/server/tests/analytics_test.go index bbce565..07f977e 100644 --- a/cmd/server/tests/analytics_test.go +++ b/cmd/server/tests/analytics_test.go @@ -51,8 +51,8 @@ func TestAnalyticsReadingStats(t *testing.T) { }) t.Run("GetReadingStats_WithCustomDateRange", func(t *testing.T) { - startDate := time.Now().AddDate(0, -2, 0).Format("2006-01-02") - endDate := time.Now().Format("2006-01-02") + startDate := time.Now().AddDate(0, -2, 0).Format("01-02-2006") + endDate := time.Now().Format("01-02-2006") req, _ := http.NewRequest("GET", setup.Server.URL+"/api/analytics/reading-stats?start_date="+startDate+"&end_date="+endDate, nil) req.Header.Set("Authorization", "Bearer "+setup.Token) @@ -378,8 +378,8 @@ func TestAnalyticsEdgeCases(t *testing.T) { client := &http.Client{} t.Run("ReadingStats_FutureDateRange", func(t *testing.T) { - startDate := time.Now().AddDate(0, 0, 7).Format("2006-01-02") - endDate := time.Now().AddDate(0, 0, 14).Format("2006-01-02") + startDate := time.Now().AddDate(0, 0, 7).Format("01-02-2006") + endDate := time.Now().AddDate(0, 0, 14).Format("01-02-2006") req, _ := http.NewRequest("GET", setup.Server.URL+"/api/analytics/reading-stats?start_date="+startDate+"&end_date="+endDate, nil) req.Header.Set("Authorization", "Bearer "+setup.Token)