Skip to content

Commit 70cad39

Browse files
committed
fix: update GitHub API calls to use the correct namespace for branch protection methods
1 parent 2ec910d commit 70cad39

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

test/unit/lib/plugins/branches.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ describe('Branches', () => {
203203

204204
describe('when existing protection has restrictions', () => {
205205
it('preserves restrictions from GitHub when config omits them', () => {
206-
github.repos.getBranchProtection = jest.fn().mockResolvedValue({
206+
github.rest.repos.getBranchProtection = jest.fn().mockResolvedValue({
207207
data: {
208208
enforce_admins: { enabled: true },
209209
required_status_checks: {
@@ -229,7 +229,7 @@ describe('Branches', () => {
229229
}])
230230

231231
return plugin.sync().then(() => {
232-
expect(github.repos.updateBranchProtection).toHaveBeenCalledWith(
232+
expect(github.rest.repos.updateBranchProtection).toHaveBeenCalledWith(
233233
expect.objectContaining({
234234
owner: 'bkeepers',
235235
repo: 'test',
@@ -253,7 +253,7 @@ describe('Branches', () => {
253253
})
254254

255255
it('normalizes restrictions and defaults missing arrays when preserving from GitHub', () => {
256-
github.repos.getBranchProtection = jest.fn().mockResolvedValue({
256+
github.rest.repos.getBranchProtection = jest.fn().mockResolvedValue({
257257
data: {
258258
enforce_admins: { enabled: true },
259259
restrictions: {
@@ -271,7 +271,7 @@ describe('Branches', () => {
271271
}])
272272

273273
return plugin.sync().then(() => {
274-
const payload = github.repos.updateBranchProtection.mock.calls[0][0]
274+
const payload = github.rest.repos.updateBranchProtection.mock.calls[0][0]
275275
expect(payload.restrictions).toEqual({
276276
users: ['user1'],
277277
teams: [],

0 commit comments

Comments
 (0)