(t *testing.T)
| 184 | } |
| 185 | |
| 186 | func TestClientPaginateVariousPageSizes(t *testing.T) { |
| 187 | ctx := context.Background() |
| 188 | for i := 1; i < len(allItems)+1; i++ { |
| 189 | testname := fmt.Sprintf("PageSize=%d", i) |
| 190 | t.Run(testname, func(t *testing.T) { |
| 191 | results := generatePaginatedResults(allItems, i) |
| 192 | listFunc := func(ctx context.Context, params *ListTestParams) (*ListTestResult, error) { |
| 193 | res := results[0] |
| 194 | results = results[1:] |
| 195 | return res, nil |
| 196 | } |
| 197 | var gotItems []*Item |
| 198 | seq := paginate(ctx, &ListTestParams{}, listFunc, func(r *ListTestResult) []*Item { return r.Items }) |
| 199 | for item, err := range seq { |
| 200 | if err != nil { |
| 201 | t.Fatalf("paginate() unexpected error during iteration: %v", err) |
| 202 | } |
| 203 | gotItems = append(gotItems, item) |
| 204 | } |
| 205 | if diff := cmp.Diff(allItems, gotItems, cmpopts.IgnoreUnexported(jsonschema.Schema{})); diff != "" { |
| 206 | t.Fatalf("paginate() mismatch (-want +got):\n%s", diff) |
| 207 | } |
| 208 | }) |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | func TestClientCapabilities(t *testing.T) { |
| 213 | testCases := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…