diff --git a/lib/workers/branch/index.js b/lib/workers/branch/index.js index 26266f18067c6e62627422903b0b566c67cb0c0e..439146ac2b0fdeb9739a2347a6b51f4578e38c7c 100644 --- a/lib/workers/branch/index.js +++ b/lib/workers/branch/index.js @@ -8,7 +8,7 @@ let logger = require('../../logger'); module.exports = { getParentBranch, ensureBranch, - updateBranch, + processBranchUpgrades, removeStandaloneBranches, }; @@ -194,7 +194,7 @@ async function ensureBranch(upgrades) { return true; } -async function updateBranch(upgrades) { +async function processBranchUpgrades(upgrades) { await removeStandaloneBranches(upgrades); const upgrade0 = upgrades[0]; // Delete the semanticPrefix for this branch if feature is not enabled diff --git a/lib/workers/repository/index.js b/lib/workers/repository/index.js index dc38e365d5777ca4b9696aeb2d643a0d13194395..736c74d1483dce4b93baa3690a82a7049549b64c 100644 --- a/lib/workers/repository/index.js +++ b/lib/workers/repository/index.js @@ -52,7 +52,7 @@ async function renovateRepository(packageFileConfig) { ); if (config.repoIsOnboarded) { for (const branchName of Object.keys(branchUpgrades)) { - await branchWorker.updateBranch(branchUpgrades[branchName]); + await branchWorker.processBranchUpgrades(branchUpgrades[branchName]); } } else { await onboarding.ensurePr(config, branchUpgrades); diff --git a/test/workers/branch/index.spec.js b/test/workers/branch/index.spec.js index 00151d58bc528924b55025addbc7185ba8115e80..dd972efaed8ea60a0e49e12ee5ceee29cf9d626d 100644 --- a/test/workers/branch/index.spec.js +++ b/test/workers/branch/index.spec.js @@ -320,7 +320,7 @@ describe('workers/branch', () => { expect(config.api.commitFilesToBranch.mock.calls.length).toBe(0); }); }); - describe('updateBranch(upgrades)', () => { + describe('processBranchUpgrades(upgrades)', () => { let config; beforeEach(() => { config = Object.assign({}, defaultConfig); @@ -333,41 +333,41 @@ describe('workers/branch', () => { }); it('returns immediately if closed PR found', async () => { config.api.checkForClosedPr.mockReturnValue(true); - await branchWorker.updateBranch([config]); + await branchWorker.processBranchUpgrades([config]); expect(branchWorker.ensureBranch.mock.calls.length).toBe(0); }); it('does not return immediately if recreateClosed true', async () => { config.api.checkForClosedPr.mockReturnValue(true); config.recreateClosed = true; - await branchWorker.updateBranch([config]); + await branchWorker.processBranchUpgrades([config]); expect(branchWorker.ensureBranch.mock.calls.length).toBe(1); }); it('pins', async () => { config.upgradeType = 'pin'; - await branchWorker.updateBranch([config]); + await branchWorker.processBranchUpgrades([config]); expect(branchWorker.ensureBranch.mock.calls.length).toBe(1); }); it('majors', async () => { config.upgradeType = 'major'; - await branchWorker.updateBranch([config]); + await branchWorker.processBranchUpgrades([config]); expect(branchWorker.ensureBranch.mock.calls.length).toBe(1); }); it('minors', async () => { config.upgradeType = 'minor'; - await branchWorker.updateBranch([config]); + await branchWorker.processBranchUpgrades([config]); expect(branchWorker.ensureBranch.mock.calls.length).toBe(1); }); it('handles semantic commits', async () => { config.upgradeType = 'minor'; config.semanticCommits = true; - await branchWorker.updateBranch([config]); + await branchWorker.processBranchUpgrades([config]); expect(branchWorker.ensureBranch.mock.calls.length).toBe(1); }); it('handles errors', async () => { config.api.checkForClosedPr = jest.fn(() => { throw new Error('oops'); }); - await branchWorker.updateBranch([config]); + await branchWorker.processBranchUpgrades([config]); expect(branchWorker.ensureBranch.mock.calls.length).toBe(0); }); }); diff --git a/test/workers/package-file/index.spec.js b/test/workers/package-file/index.spec.js index 238785d6ffc596840627f679ad4a95413141dbe0..1b24470bbd198bb74ef4361cd4c5ff9fd0f47198 100644 --- a/test/workers/package-file/index.spec.js +++ b/test/workers/package-file/index.spec.js @@ -20,7 +20,6 @@ describe('packageFileWorker', () => { depTypes: ['dependencies', 'devDependencies'], logger, }); - packageFileWorker.updateBranch = jest.fn(); }); it('handles null', async () => { const allUpgrades = await packageFileWorker.findUpgrades(config); diff --git a/test/workers/repository/index.spec.js b/test/workers/repository/index.spec.js index 4b2abab7cde515126540507afa8a3daaeaf19dbb..ab6c20dc271f52c988674d39a8b6e3c61849d73c 100644 --- a/test/workers/repository/index.spec.js +++ b/test/workers/repository/index.spec.js @@ -19,7 +19,7 @@ describe('workers/repository', () => { onboarding.ensurePr = jest.fn(); upgrades.determineRepoUpgrades = jest.fn(() => []); upgrades.branchifyUpgrades = jest.fn(() => ({})); - branchWorker.updateBranch = jest.fn(); + branchWorker.processBranchUpgrades = jest.fn(); config = { api: { getFileJson: jest.fn(), @@ -54,7 +54,7 @@ describe('workers/repository', () => { ); await repositoryWorker.renovateRepository(config); expect(onboarding.getOnboardingStatus.mock.calls.length).toBe(1); - expect(branchWorker.updateBranch.mock.calls.length).toBe(0); + expect(branchWorker.processBranchUpgrades.mock.calls.length).toBe(0); expect(onboarding.ensurePr.mock.calls.length).toBe(1); expect(config.logger.error.mock.calls.length).toBe(0); }); @@ -68,7 +68,7 @@ describe('workers/repository', () => { baz: {}, }); await repositoryWorker.renovateRepository(config); - expect(branchWorker.updateBranch.mock.calls.length).toBe(3); + expect(branchWorker.processBranchUpgrades.mock.calls.length).toBe(3); expect(config.logger.error.mock.calls.length).toBe(0); }); it('swallows errors', async () => {