add filter read/want read when browsing books

This commit is contained in:
2025-11-07 16:09:54 +01:00
parent 844ddaa7dc
commit f8ad54392a
11 changed files with 171 additions and 53 deletions

View File

@@ -0,0 +1,29 @@
package apitest
import (
"testing"
"git.artlef.fr/PersonalLibraryManager/internal/testutils"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
)
func TestGetWantReadBooksHandler_Demo(t *testing.T) {
router := testutils.TestSetup()
token := testutils.ConnectDemoUser(router)
books := testGetWantReadBooksHandler(t, router, token, 200)
assert.Equal(t, 2, len(books))
}
func TestGetWantReadBooksHandler_Demo2(t *testing.T) {
router := testutils.TestSetup()
token := testutils.ConnectDemo2User(router)
books := testGetWantReadBooksHandler(t, router, token, 200)
assert.Equal(t, 0, len(books))
}
func testGetWantReadBooksHandler(t *testing.T, router *gin.Engine, userToken string, expectedCode int) []bookUserGet {
return testGetbooksHandler(t, router, userToken, expectedCode, "/mybooks/wantread")
}