MCPcopy Create free account
hub / github.com/basecamp/hey-cli / TestPaginateBoxPostings_LimitExceedsFirstPage

Function TestPaginateBoxPostings_LimitExceedsFirstPage

internal/cmd/box_test.go:124–143  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

122}
123
124func 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
145func TestPaginateBoxPostings_LimitSatisfiedByFirstPage(t *testing.T) {
146 first := &generated.BoxShowResponse{

Callers

nothing calls this directly

Calls 4

makePostingsFunction · 0.85
paginateBoxPostingsFunction · 0.85
mockFetcherFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected