22 lines
598 B
Go
22 lines
598 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 TestFetchAllCollections_OK(t *testing.T) {
|
|
status, res := testFetchCollections(t, "10", "0")
|
|
assert.Equal(t, http.StatusOK, status)
|
|
assert.Equal(t, int64(2), res.Count)
|
|
assert.Equal(t, 2, 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)
|
|
}
|