Skip to content

Commit b274df9

Browse files
committed
fix: update ListBranches test to handle errors in tool result
1 parent 64cde12 commit b274df9

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

pkg/github/repositories_test.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,16 +1347,18 @@ func Test_ListBranches(t *testing.T) {
13471347
args: map[string]interface{}{
13481348
"repo": "repo",
13491349
},
1350-
wantErr: true,
1351-
errContains: "missing required parameter: owner",
1350+
mockResponses: []mock.MockBackendOption{},
1351+
wantErr: false,
1352+
errContains: "missing required parameter: owner",
13521353
},
13531354
{
13541355
name: "missing repo",
13551356
args: map[string]interface{}{
13561357
"owner": "owner",
13571358
},
1358-
wantErr: true,
1359-
errContains: "missing required parameter: repo",
1359+
mockResponses: []mock.MockBackendOption{},
1360+
wantErr: false,
1361+
errContains: "missing required parameter: repo",
13601362
},
13611363
}
13621364

@@ -1381,6 +1383,13 @@ func Test_ListBranches(t *testing.T) {
13811383

13821384
require.NoError(t, err)
13831385
require.NotNil(t, result)
1386+
1387+
if tt.errContains != "" {
1388+
textContent := getTextResult(t, result)
1389+
assert.Contains(t, textContent.Text, tt.errContains)
1390+
return
1391+
}
1392+
13841393
textContent := getTextResult(t, result)
13851394
require.NotEmpty(t, textContent.Text)
13861395

0 commit comments

Comments
 (0)