Refactor and improve RepoMetadata teams test
Renamed the test to clarify its purpose and added an explicit exclusion for the OrganizationTeamList GraphQL query to ensure teams are only fetched when specified. This improves test accuracy and readability.
This commit is contained in:
parent
e5feda353f
commit
addee16531
1 changed files with 8 additions and 3 deletions
|
|
@ -214,14 +214,14 @@ func Test_RepoMetadata(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func Test_RepoMetadataTeams(t *testing.T) {
|
||||
// Test that RepoMetadata only fetches teams if the input specifies it
|
||||
// Test that RepoMetadata only fetches teams if the input specifies it
|
||||
func Test_RepoMetadata_TeamsAreConditionallyFetched(t *testing.T) {
|
||||
http := &httpmock.Registry{}
|
||||
client := newTestClient(http)
|
||||
repo, _ := ghrepo.FromFullName("OWNER/REPO")
|
||||
input := RepoMetadataInput{
|
||||
Reviewers: true,
|
||||
TeamReviewers: false,
|
||||
TeamReviewers: false, // Do not fetch teams
|
||||
}
|
||||
|
||||
http.Register(
|
||||
|
|
@ -242,6 +242,11 @@ func Test_RepoMetadataTeams(t *testing.T) {
|
|||
{ "data": { "viewer": { "login": "monalisa" } } }
|
||||
`))
|
||||
|
||||
http.Exclude(
|
||||
t,
|
||||
httpmock.GraphQL(`query OrganizationTeamList\b`),
|
||||
)
|
||||
|
||||
_, err := RepoMetadata(client, repo, input)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue