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

Function Test_PaginateNextSkip

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

Source from the content-addressed store, hash-verified

617}
618
619func Test_PaginateNextSkip(t *testing.T) {
620 t.Parallel()
621 app := fiber.New()
622 app.Use(New(Config{
623 Next: func(_ fiber.Ctx) bool {
624 return true
625 },
626 }))
627
628 app.Get("/", func(c fiber.Ctx) error {
629 _, ok := FromContext(c)
630 if !ok {
631 return fiber.ErrBadRequest
632 }
633 return c.JSON(nil)
634 })
635
636 resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/", http.NoBody))
637 require.NoError(t, err)
638 defer resp.Body.Close() //nolint:errcheck // close error not relevant in tests
639 require.Equal(t, fiber.StatusBadRequest, resp.StatusCode)
640}
641
642func Test_PaginateEdgeCases(t *testing.T) {
643 t.Parallel()

Callers

nothing calls this directly

Calls 8

TestMethod · 0.80
NewFunction · 0.70
FromContextFunction · 0.70
NewMethod · 0.65
UseMethod · 0.65
GetMethod · 0.65
JSONMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected