mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-12-05 08:05:12 +00:00
Use strconv to reject pagination values outside the native int range, reuse PaginationParams.Offset for API key slices, and derive test bounds from math.MaxInt. Cover parsing, response metadata, strict handlers, and in-memory pagination at the arithmetic boundaries.
18 lines
424 B
Go
18 lines
424 B
Go
package repository
|
|
|
|
import (
|
|
"math"
|
|
"testing"
|
|
|
|
"github.com/Wei-Shaw/sub2api/internal/pkg/pagination"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestPaginateSliceLargePage(t *testing.T) {
|
|
t.Parallel()
|
|
for _, size := range []int{0, 1, 2, 3, 20, 21, 1000, 1001} {
|
|
params := pagination.PaginationParams{Page: math.MaxInt, PageSize: size}
|
|
require.Empty(t, paginateSlice([]int{1}, params), "page_size=%d", size)
|
|
}
|
|
}
|