diff --git a/lib/workers/repository/update/pr/body/controls.spec.ts b/lib/workers/repository/update/pr/body/controls.spec.ts deleted file mode 100644 index bfed66aef41a9ffd21a3c1a5f32f1f38014bebf6..0000000000000000000000000000000000000000 --- a/lib/workers/repository/update/pr/body/controls.spec.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { mock } from 'jest-mock-extended'; -import { git } from '../../../../../../test/util'; -import type { BranchConfig } from '../../../../types'; -import { getControls } from './controls'; - -jest.mock('../../../../../util/git'); - -describe('workers/repository/update/pr/body/controls', () => { - describe('getControls', () => { - let branchConfig: BranchConfig; - - beforeEach(() => { - jest.resetAllMocks(); - branchConfig = mock<BranchConfig>(); - branchConfig.branchName = 'branchName'; - }); - - describe(`when the branch is modified`, () => { - beforeEach(() => { - git.isBranchModified.mockResolvedValue(true); - }); - - it('has the correct contents', async () => { - expect(await getControls(branchConfig)).toContain( - `- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. ⚠ **Warning**: custom changes will be lost.` - ); - expect(git.isBranchModified).toHaveBeenCalledTimes(1); - expect(git.isBranchModified).toHaveBeenCalledWith( - branchConfig.branchName - ); - }); - }); - - describe(`when the branch is not modified`, () => { - beforeEach(() => { - git.isBranchModified.mockResolvedValue(false); - }); - - it('has the correct contents', async () => { - expect(await getControls(branchConfig)).toContain( - `- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.` - ); - expect(git.isBranchModified).toHaveBeenCalledTimes(1); - expect(git.isBranchModified).toHaveBeenCalledWith( - branchConfig.branchName - ); - }); - }); - }); -}); diff --git a/lib/workers/repository/update/pr/body/controls.ts b/lib/workers/repository/update/pr/body/controls.ts index 037c672c043632e05b91a3b03aadb1bc3728db1e..c2e78b72d8b22cf90badc2cc3dbc55df2d169c8c 100644 --- a/lib/workers/repository/update/pr/body/controls.ts +++ b/lib/workers/repository/update/pr/body/controls.ts @@ -1,10 +1,3 @@ -import { emojify } from '../../../../../util/emoji'; -import { isBranchModified } from '../../../../../util/git'; -import type { BranchConfig } from '../../../../types'; - -export async function getControls(config: BranchConfig): Promise<string> { - const warning = (await isBranchModified(config.branchName)) - ? emojify(' :warning: **Warning**: custom changes will be lost.') - : ''; - return `\n\n---\n\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.${warning}\n\n`; +export function getControls(): string { + return `\n\n---\n\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box\n\n`; } diff --git a/lib/workers/repository/update/pr/body/index.spec.ts b/lib/workers/repository/update/pr/body/index.spec.ts index f9cb535adae1f9989f29e548219e05a118a1d7f8..992b8f4c1e807edb29742f087294dca618322e87 100644 --- a/lib/workers/repository/update/pr/body/index.spec.ts +++ b/lib/workers/repository/update/pr/body/index.spec.ts @@ -42,7 +42,7 @@ describe('workers/repository/update/pr/body/index', () => { configDescription.getPrConfigDescription.mockResolvedValueOnce( 'getPrConfigDescription' ); - controls.getControls.mockResolvedValueOnce('getControls'); + controls.getControls.mockReturnValueOnce('getControls'); footer.getPrFooter.mockReturnValueOnce('getPrFooter'); header.getPrHeader.mockReturnValueOnce('getPrHeader'); notes.getPrExtraNotes.mockReturnValueOnce('getPrExtraNotes'); diff --git a/lib/workers/repository/update/pr/body/index.ts b/lib/workers/repository/update/pr/body/index.ts index a0c21528aa294dc3561a782617e6867cbc454349..c3d25a8a8dc28710b9a104cf294c49d52e4329a5 100644 --- a/lib/workers/repository/update/pr/body/index.ts +++ b/lib/workers/repository/update/pr/body/index.ts @@ -85,7 +85,7 @@ export async function getPrBody( notes: getPrNotes(branchConfig) + getPrExtraNotes(branchConfig), changelogs: getChangelogs(branchConfig), configDescription: await getPrConfigDescription(branchConfig), - controls: await getControls(branchConfig), + controls: getControls(), footer: getPrFooter(branchConfig), };