(t *testing.T)
| 122 | } |
| 123 | |
| 124 | func TestPaginateBoxPostings_LimitExceedsFirstPage(t *testing.T) { |
| 125 | first := &generated.BoxShowResponse{ |
| 126 | Postings: makePostings(30, 0), |
| 127 | NextHistoryUrl: "https://app.hey.com/page2", |
| 128 | } |
| 129 | pages := []generated.BoxShowResponse{ |
| 130 | {Postings: makePostings(30, 30), NextHistoryUrl: "https://app.hey.com/page3"}, |
| 131 | } |
| 132 | |
| 133 | postings, nextURL, err := paginateBoxPostings(context.Background(), first, 50, false, mockFetcher(pages)) |
| 134 | if err != nil { |
| 135 | t.Fatal(err) |
| 136 | } |
| 137 | if len(postings) != 60 { |
| 138 | t.Errorf("expected 60 postings, got %d", len(postings)) |
| 139 | } |
| 140 | if nextURL == "" { |
| 141 | t.Error("expected non-empty nextURL when stopped by limit with more pages available") |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | func TestPaginateBoxPostings_LimitSatisfiedByFirstPage(t *testing.T) { |
| 146 | first := &generated.BoxShowResponse{ |
nothing calls this directly
no test coverage detected