Skip to content

Commit 8a332fc

Browse files
committed
fix test expectations for no teams found
1 parent 2d183e1 commit 8a332fc

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

pkg/github/context_tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func GetTeams(getClient GetClientFn, getGQLClient GetGQLClientFn, t translations
157157
return mcp.NewToolResultError(err.Error()), nil
158158
}
159159

160-
return MarshalledTextResult(t), nil
160+
return MarshalledTextResult(q.User.Organizations.Nodes), nil
161161
})
162162

163163
return tool, handler

pkg/github/context_tools_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ func Test_GetTeams(t *testing.T) {
285285
return githubv4.NewClient(httpClient), nil
286286
},
287287
requestArgs: map[string]any{},
288-
expectToolError: true,
289-
expectedToolErrMsg: "no teams found for user",
288+
expectToolError: false,
289+
expectedTeamsCount: 0,
290290
},
291291
{
292292
name: "getting client fails",
@@ -366,9 +366,11 @@ func Test_GetTeams(t *testing.T) {
366366
assert.Equal(t, "team1", organizations[0].Teams.Nodes[0].Name)
367367
assert.Equal(t, "team1", organizations[0].Teams.Nodes[0].Slug)
368368

369-
assert.Equal(t, "testorg2", organizations[1].Login)
370-
assert.Len(t, organizations[1].Teams.Nodes, 1)
371-
assert.Equal(t, "team3", organizations[1].Teams.Nodes[0].Name)
369+
if tc.expectedTeamsCount > 1 {
370+
assert.Equal(t, "testorg2", organizations[1].Login)
371+
assert.Len(t, organizations[1].Teams.Nodes, 1)
372+
assert.Equal(t, "team3", organizations[1].Teams.Nodes[0].Name)
373+
}
372374
}
373375
})
374376
}

0 commit comments

Comments
 (0)