fix wording, move conditional blocks to functions, and add api to retrieve the ID of a team

This commit is contained in:
benebsiny 2024-01-24 14:37:28 +08:00
parent c9184d2ba2
commit 7fd91f593c
5 changed files with 120 additions and 96 deletions

View file

@ -31,13 +31,13 @@ func TestNewCmdUnlink(t *testing.T) {
name: "specify-nothing",
cli: "",
wantsErr: true,
wantsErrMsg: "specify at least one repo or team",
wantsErrMsg: "specify either `--repo` or `--team`",
},
{
name: "specify-repo-and-team",
cli: "--repo my-repo --team my-team",
wantsErr: true,
wantsErrMsg: "specify only one repo or team",
wantsErrMsg: "specify only one of `--repo` or `--team`",
},
{
name: "repo",
@ -316,8 +316,8 @@ func TestRunUnlink_Team(t *testing.T) {
defer httpReg.Verify(t)
httpReg.Register(
httpmock.GraphQL(`query OrganizationTeamList\b`),
httpmock.StringResponse(`{"data":{"organization":{"teams":{"nodes": [{"id": "team-ID", "slug": "my-team"}]}}}}`),
httpmock.GraphQL(`query OrganizationTeam\b`),
httpmock.StringResponse(`{"data":{"organization":{"team":{"id": "team-ID"}}}}`),
)
httpClient := newTestClient(httpReg)