MCPcopy
hub / github.com/gofiber/fiber / Test_PageInfoPreviousPageURL

Function Test_PageInfoPreviousPageURL

middleware/paginate/paginate_test.go:185–214  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

183}
184
185func Test_PageInfoPreviousPageURL(t *testing.T) {
186 t.Parallel()
187
188 tests := []struct {
189 name string
190 baseURL string
191 expected string
192 pageInfo PageInfo
193 }{
194 {
195 name: "Middle page",
196 baseURL: "https://example.com/users",
197 expected: "https://example.com/users?limit=10&page=1",
198 pageInfo: PageInfo{Page: 2, Limit: 10},
199 },
200 {
201 name: "First page returns empty",
202 baseURL: "https://example.com/users",
203 expected: "",
204 pageInfo: PageInfo{Page: 1, Limit: 20},
205 },
206 }
207
208 for _, tt := range tests {
209 t.Run(tt.name, func(t *testing.T) {
210 t.Parallel()
211 require.Equal(t, tt.expected, tt.pageInfo.PreviousPageURL(tt.baseURL))
212 })
213 }
214}
215
216func Test_PageInfoStartCursorMode(t *testing.T) {
217 t.Parallel()

Callers

nothing calls this directly

Calls 1

PreviousPageURLMethod · 0.80

Tested by

no test coverage detected