Select Git revision
commit.spec.js
-
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.
Rhys Arkins authoredThis 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();
});
});
});