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.
This commit is contained in:
2026-05-01 16:59:49 -04:00
parent 8c7266e93b
commit 06985474d0
+4 -4
View File
@@ -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)