Skip to content
Snippets Groups Projects
Commit 4b2f523a authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix: correct baseBranches description in onboarding PR

Closes #6527
parent 0345b40a
No related branches found
No related tags found
No related merge requests found
...@@ -5,3 +5,5 @@ exports[`workers/repository/onboarding/pr/base-branch getBaseBranchDesc() descri ...@@ -5,3 +5,5 @@ exports[`workers/repository/onboarding/pr/base-branch getBaseBranchDesc() descri
" "
`; `;
exports[`workers/repository/onboarding/pr/base-branch getBaseBranchDesc() describes baseBranches 1`] = `"You have configured Renovate to use the following baseBranches: \`some-branch\`, \`some-other-branch\`."`;
...@@ -14,7 +14,12 @@ describe('workers/repository/onboarding/pr/base-branch', () => { ...@@ -14,7 +14,12 @@ describe('workers/repository/onboarding/pr/base-branch', () => {
expect(res).toEqual(''); expect(res).toEqual('');
}); });
it('describes baseBranch', () => { it('describes baseBranch', () => {
config.baseBranch = 'some-branch'; config.baseBranches = ['some-branch'];
const res = getBaseBranchDesc(config);
expect(res).toMatchSnapshot();
});
it('describes baseBranches', () => {
config.baseBranches = ['some-branch', 'some-other-branch'];
const res = getBaseBranchDesc(config); const res = getBaseBranchDesc(config);
expect(res).toMatchSnapshot(); expect(res).toMatchSnapshot();
}); });
......
...@@ -2,7 +2,13 @@ import { RenovateConfig } from '../../../../config'; ...@@ -2,7 +2,13 @@ import { RenovateConfig } from '../../../../config';
export function getBaseBranchDesc(config: RenovateConfig): string { export function getBaseBranchDesc(config: RenovateConfig): string {
// Describe base branch only if it's configured // Describe base branch only if it's configured
return config.baseBranch if (!config.baseBranches?.length) {
? `You have configured Renovate to use branch \`${config.baseBranch}\` as base branch.\n\n` return '';
: ''; }
if (config.baseBranches.length > 1) {
return `You have configured Renovate to use the following baseBranches: ${config.baseBranches
.map((branch) => `\`${branch}\``)
.join(', ')}.`;
}
return `You have configured Renovate to use branch \`${config.baseBranches[0]}\` as base branch.\n\n`;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment