MCPcopy Index your code
hub / github.com/github/github-mcp-server / TestOptionalPaginationParams

Function TestOptionalPaginationParams

pkg/github/params_test.go:552–644  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

550}
551
552func TestOptionalPaginationParams(t *testing.T) {
553 tests := []struct {
554 name string
555 params map[string]any
556 expected PaginationParams
557 expectError bool
558 }{
559 {
560 name: "no pagination parameters, default values",
561 params: map[string]any{},
562 expected: PaginationParams{
563 Page: 1,
564 PerPage: 30,
565 },
566 expectError: false,
567 },
568 {
569 name: "page parameter, default perPage",
570 params: map[string]any{
571 "page": float64(2),
572 },
573 expected: PaginationParams{
574 Page: 2,
575 PerPage: 30,
576 },
577 expectError: false,
578 },
579 {
580 name: "perPage parameter, default page",
581 params: map[string]any{
582 "perPage": float64(50),
583 },
584 expected: PaginationParams{
585 Page: 1,
586 PerPage: 50,
587 },
588 expectError: false,
589 },
590 {
591 name: "page and perPage parameters",
592 params: map[string]any{
593 "page": float64(2),
594 "perPage": float64(50),
595 },
596 expected: PaginationParams{
597 Page: 2,
598 PerPage: 50,
599 },
600 expectError: false,
601 },
602 {
603 name: "invalid page parameter",
604 params: map[string]any{
605 "page": "not-a-number",
606 },
607 expected: PaginationParams{},
608 expectError: true,
609 },

Callers

nothing calls this directly

Calls 2

OptionalPaginationParamsFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected