(t *testing.T)
| 206 | } |
| 207 | |
| 208 | func TestTeamListGroupsJSONPaginates(t *testing.T) { |
| 209 | continueCalled := false |
| 210 | stubTeamClient(t, &mockTeamClient{ |
| 211 | groupsListFn: func(arg *team.GroupsListArg) (*team.GroupsListResult, error) { |
| 212 | return team.NewGroupsListResult([]*team_common.GroupSummary{ |
| 213 | testTeamGroup("Engineering", "gid:eng", 3), |
| 214 | }, "group-cursor", true), nil |
| 215 | }, |
| 216 | groupsListContinueFn: func(arg *team.GroupsListContinueArg) (*team.GroupsListResult, error) { |
| 217 | continueCalled = true |
| 218 | if arg.Cursor != "group-cursor" { |
| 219 | t.Fatalf("continue cursor = %q, want group-cursor", arg.Cursor) |
| 220 | } |
| 221 | return team.NewGroupsListResult([]*team_common.GroupSummary{ |
| 222 | testTeamGroup("Support", "gid:support", 2), |
| 223 | }, "", false), nil |
| 224 | }, |
| 225 | }) |
| 226 | |
| 227 | cmd, stdout := teamTestCmd(t, true) |
| 228 | if err := listGroups(cmd, nil); err != nil { |
| 229 | t.Fatalf("listGroups error: %v", err) |
| 230 | } |
| 231 | if !continueCalled { |
| 232 | t.Fatal("GroupsListContinue was not called") |
| 233 | } |
| 234 | got := decodeTeamOperationOutput[map[string]any, teamGroupJSON](t, stdout.Bytes()) |
| 235 | if len(got.Results) != 2 { |
| 236 | t.Fatalf("results length = %d, want 2", len(got.Results)) |
| 237 | } |
| 238 | if got.Results[0].Status != teamJSONStatusListed || got.Results[0].Kind != teamJSONKindTeamGroup { |
| 239 | t.Fatalf("first result = %#v, want listed team_group", got.Results[0]) |
| 240 | } |
| 241 | if got.Results[0].Result.GroupName != "Engineering" || got.Results[0].Result.MemberCount != 3 { |
| 242 | t.Fatalf("first result = %#v, want engineering group", got.Results[0].Result) |
| 243 | } |
| 244 | if got.Results[1].Result.GroupName != "Support" { |
| 245 | t.Fatalf("second result = %#v, want support group", got.Results[1].Result) |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | func TestTeamAddMemberJSONOutputsMutationResult(t *testing.T) { |
| 250 | var gotArg *team.MembersAddArg |
nothing calls this directly
no test coverage detected