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.
This commit is contained in:
@@ -25,28 +25,6 @@ func TestAnalyticsReadingStats(t *testing.T) {
|
|||||||
assert.Equal(t, http.StatusUnauthorized, resp.StatusCode)
|
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) {
|
t.Run("GetReadingStats_WithAuth_DefaultDates", func(t *testing.T) {
|
||||||
setup := setupTestServer(t)
|
setup := setupTestServer(t)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user