Add author books list

This commit is contained in:
2025-11-25 18:11:27 +01:00
parent 624dfe0faa
commit 9ea7ef2e50
9 changed files with 233 additions and 19 deletions

View File

@@ -71,3 +71,22 @@ func TestGetReadingBooksCountHandler_Demo(t *testing.T) {
}
assert.Equal(t, 2, c.Count)
}
func TestGetAuthorsBooksCountHandler_Demo(t *testing.T) {
router := testutils.TestSetup()
token := testutils.ConnectDemoUser(router)
req, _ := http.NewRequest("GET", "/author/1/books/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, 3, c.Count)
}