Skip to content
Snippets Groups Projects
Select Git revision
21 results Searching

commit.spec.js

Blame
    • Rhys Arkins's avatar
      9753f9dc
      feat: modular branchName/prTitle/commitMessage templating (#1760) · 9753f9dc
      Rhys Arkins authored
      This PR refactors `branchName`, `commitMessage` and `prTitle` so that they are more easily editable and hopefully more understandable. By breaking each up into subsections, users can modify one part without needing to copy/paste the entire string.
      
      Directly editing any of these fields will now be deprecated and a warning issued.
      9753f9dc
      History
      feat: modular branchName/prTitle/commitMessage templating (#1760)
      Rhys Arkins authored
      This PR refactors `branchName`, `commitMessage` and `prTitle` so that they are more easily editable and hopefully more understandable. By breaking each up into subsections, users can modify one part without needing to copy/paste the entire string.
      
      Directly editing any of these fields will now be deprecated and a warning issued.
    commit.spec.js 1.11 KiB
    const { commitFilesToBranch } = require('../../../lib/workers/branch/commit');
    const defaultConfig = require('../../../lib/config/defaults').getConfig();
    
    describe('workers/branch/automerge', () => {
      describe('commitFilesToBranch', () => {
        let config;
        beforeEach(() => {
          config = {
            ...defaultConfig,
            branchName: 'renovate/some-branch',
            commitMessage: 'some commit message',
            semanticCommits: false,
            semanticCommitType: 'a',
            semanticCommitScope: 'b',
            updatedPackageFiles: [],
            updatedLockFiles: [],
          };
          jest.resetAllMocks();
        });
        it('handles empty files', async () => {
          await commitFilesToBranch(config);
          expect(platform.commitFilesToBranch.mock.calls.length).toBe(0);
        });
        it('commits files', async () => {
          config.updatedPackageFiles.push({
            name: 'package.json',
            contents: 'some contents',
          });
          await commitFilesToBranch(config);
          expect(platform.commitFilesToBranch.mock.calls.length).toBe(1);
          expect(platform.commitFilesToBranch.mock.calls).toMatchSnapshot();
        });
      });
    });