22 lines
564 B
Go
22 lines
564 B
Go
package apitest
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
"git.artlef.fr/bibliomane/internal/dto"
|
|
"git.artlef.fr/bibliomane/internal/testutils"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestFetchAllBooks(t *testing.T) {
|
|
status, result := testFetchBooks(t, "15", "0")
|
|
assert.Equal(t, http.StatusOK, status)
|
|
assert.Equal(t, int64(31), result.Count)
|
|
assert.Equal(t, 15, len(result.Books))
|
|
}
|
|
|
|
func testFetchBooks(t *testing.T, limit string, offset string) (int, dto.BookItemsGet) {
|
|
return testutils.TestFetchModel[dto.BookItemsGet](t, "/ws/books", limit, offset)
|
|
}
|