Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft Graph v1.0: teams team list #2507

Closed
garrytrinder opened this issue Jun 13, 2021 · 4 comments
Closed

Microsoft Graph v1.0: teams team list #2507

garrytrinder opened this issue Jun 13, 2021 · 4 comments

Comments

@garrytrinder
Copy link
Member

The teams team list command uses beta endpoints for two requests that can now use v1.0 endpoints.

if (args.options.joined) {
endpoint = `${this.resource}/beta/me/joinedTeams`;
}

List joinedTeams: https://docs.microsoft.com/en-us/graph/api/user-list-joinedteams?view=graph-rest-1.0&tabs=http

const requestOptions: any = {
url: `${this.resource}/beta/teams/${group.id}`,
headers: {
accept: 'application/json;odata.metadata=none'
},
responseType: 'json'
};

Get team: https://docs.microsoft.com/en-us/graph/api/team-get?view=graph-rest-1.0&tabs=http

@dips365
Copy link
Contributor

dips365 commented Jun 14, 2021

Would like to take this.
Could you please assign to me ?

@waldekmastykarz
Copy link
Member

Awesome! Appreciate your help @dips365 👍

@dips365
Copy link
Contributor

dips365 commented Jul 5, 2021

@waldekmastykarz

I completed code part with v1.0 to get teams.

return Promise.all(
this.items.filter((e: any) => {
return e.resourceProvisioningOptions.indexOf('Team') > -1;
}).map(
g => this.getTeamFromGroup(g)
)
);

Could you please help me out how can I write test cases for this bunch of code ?

@waldekmastykarz
Copy link
Member

One way to go about it would be to mock the GET call with three responses:

  1. Return three groups, two of which are related to Teams and one that isn't
  2. Return the Team for the first group related to Teams
  3. Return the Team for the second group related to Teams
  4. For all other cases return an Invalid request error

If the commands completed without error, the code is proven to work (ie. not trying to retrieve information about a group that's not linked to a Team). Does this help?

@garrytrinder garrytrinder added this to the v3.13 milestone Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment