Skip to content

Commit 9b49716

Browse files
decyjphrCopilot
andcommitted
Fix suborgrepos tests to mock paginate for glob resolution
The implementation now resolves suborgrepos glob patterns against installation repos via github.paginate(). Updated the tests to mock paginate returning the repos that match the patterns. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6d9e38c commit 9b49716

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/unit/lib/settings.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,12 @@ repository:
14441444
return Promise.resolve({ data: { content: currentContent } })
14451445
})
14461446

1447+
// Mock installation repos for glob resolution
1448+
stubContext.octokit.paginate = jest.fn().mockResolvedValue([
1449+
{ name: 'repo-a', owner: { login: 'test' } },
1450+
{ name: 'repo-b', owner: { login: 'test' } }
1451+
])
1452+
14471453
// Current subOrgConfigs only has repo-b (repo-a was removed from targeting)
14481454
settings.subOrgConfigs = {
14491455
'repo-b': { source: '.github/suborgs/frontend.yml' }
@@ -1569,6 +1575,12 @@ repository:
15691575
data: { content: previousContent }
15701576
})
15711577

1578+
// Mock installation repos for glob resolution
1579+
stubContext.octokit.paginate = jest.fn().mockResolvedValue([
1580+
{ name: 'repo-a', owner: { login: 'test' } },
1581+
{ name: 'repo-b', owner: { login: 'test' } }
1582+
])
1583+
15721584
// Neither repo matches current targeting
15731585
settings.subOrgConfigs = {}
15741586

0 commit comments

Comments
 (0)