First implementation of fetching collections of book managed by user
This commit is contained in:
21
internal/apitest/fetchallcollections_test.go
Normal file
21
internal/apitest/fetchallcollections_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package apitest
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"git.artlef.fr/bibliomane/internal/dto"
|
||||
"git.artlef.fr/bibliomane/internal/testutils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestFetchAllCollections_OK(t *testing.T) {
|
||||
status, res := testFetchCollections(t, "10", "0")
|
||||
assert.Equal(t, http.StatusOK, status)
|
||||
assert.Equal(t, int64(3), res.Count)
|
||||
assert.Equal(t, 3, len(res.Collections))
|
||||
}
|
||||
|
||||
func testFetchCollections(t *testing.T, limit string, offset string) (int, dto.CollectionItemsGet) {
|
||||
return testutils.TestFetchModel[dto.CollectionItemsGet](t, "/ws/collections", limit, offset)
|
||||
}
|
||||
Reference in New Issue
Block a user