add "reading" filter for books currently being read

This commit is contained in:
2025-11-24 13:58:31 +01:00
parent 8c0a9fe431
commit 46492967a3
9 changed files with 154 additions and 2 deletions

View File

@@ -52,3 +52,22 @@ func TestGetWantReadBooksCountHandler_Demo(t *testing.T) {
}
assert.Equal(t, 2, c.Count)
}
func TestGetReadingBooksCountHandler_Demo(t *testing.T) {
router := testutils.TestSetup()
token := testutils.ConnectDemoUser(router)
req, _ := http.NewRequest("GET", "/mybooks/reading/count", nil)
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token))
w := httptest.NewRecorder()
router.ServeHTTP(w, req)
var c countResponse
err := json.Unmarshal(w.Body.Bytes(), &c)
if err != nil {
t.Error(err)
}
assert.Equal(t, 2, c.Count)
}