Skip to content
Snippets Groups Projects
Select Git revision
  • v2.0.1
  • master default
  • v3.4
  • v3.5
  • v2.11
  • v3.3
  • v3.2
  • v3.1
  • v3.0
  • v1.0
  • v1.1
  • v1.2
  • v1.3
  • v1.4
  • v2.10
  • v1.5
  • v1.6
  • v1.7
  • v2.0
  • v2.1
  • v2.2
  • v3.5.0
  • v3.4.5
  • v2.11.28
  • v3.5.0-rc2
  • v3.4.4
  • v2.11.27
  • v3.5.0-rc1
  • v3.4.3
  • v3.4.2
  • v2.11.26
  • v3.4.1
  • v2.11.25
  • v3.4.0
  • v3.3.7
  • v3.4.0-rc2
  • v3.3.6
  • v2.11.24
  • v2.11.23
  • v3.4.0-rc1
  • v3.3.5
41 results

crossbinary-default

Blame
  • commit.spec.ts 1.47 KiB
    import { defaultConfig, git, partial } from '../../../test/util';
    import { BranchConfig } from '../common';
    import { commitFilesToBranch } from './commit';
    
    jest.mock('../../util/git');
    
    describe('workers/branch/automerge', () => {
      describe('commitFilesToBranch', () => {
        let config: BranchConfig;
        beforeEach(() => {
          config = partial<BranchConfig>({
            ...defaultConfig,
            branchName: 'renovate/some-branch',
            commitMessage: 'some commit message',
            semanticCommits: false,
            semanticCommitType: 'a',
            semanticCommitScope: 'b',
            updatedPackageFiles: [],
            updatedArtifacts: [],
          });
          jest.resetAllMocks();
          git.commitFiles.mockResolvedValueOnce('abc123');
        });
        it('handles empty files', async () => {
          await commitFilesToBranch(config);
          expect(git.commitFiles).toHaveBeenCalledTimes(0);
        });
        it('commits files', async () => {
          config.updatedPackageFiles.push({
            name: 'package.json',
            contents: 'some contents',
          });
          await commitFilesToBranch(config);
          expect(git.commitFiles).toHaveBeenCalledTimes(1);
          expect(git.commitFiles.mock.calls).toMatchSnapshot();
        });
        it('dry runs', async () => {
          config.dryRun = true;
          config.updatedPackageFiles.push({
            name: 'package.json',
            contents: 'some contents',
          });
          await commitFilesToBranch(config);
          expect(git.commitFiles).toHaveBeenCalledTimes(0);
        });
      });
    });