Skip to content
Snippets Groups Projects
Select Git revision
  • 076ee25bfb12c7ae817d5154025d3125ef0ba866
  • master default protected
  • gh-pages
  • dependabot/npm_and_yarn/nock-14.0.6
  • dependabot/npm_and_yarn/react-19.1.0
  • dependabot/npm_and_yarn/react-dom-19.1.0
  • server-2025-02-01-6100669a
  • server-2024-11-01-87cba042
  • server-2024-10-01-6875b7c8
  • dependabot/npm_and_yarn/path-to-regexp-8.2.0
  • server-2024-09-01-3d52575c
  • daily-tests-gha2
  • daily-tests-gha
  • server-2023-12-01-92d8fb8e
  • server-2023-11-01-a80c93fd
  • server-2023-10-01-31096085
  • coc-v2
  • server-2023-09-01-8edc3810
  • server-2023-08-01-75858a03
  • server-2023-07-01-02183d8d
  • test-9317
  • server-2025-07-01
  • 5.0.2
  • 5.0.1
  • 5.0.0
  • server-2025-06-01
  • server-2025-05-01
  • server-2025-04-03
  • server-2025-03-02
  • server-2025-03-01
  • server-2025-02-02
  • server-2025-01-01
  • server-2024-12-01
  • server-2024-11-02
  • 4.1.0
  • server-2024-09-25
  • server-2024-09-02
  • server-2024-08-01
  • server-2024-07-01
  • 4.0.0
  • server-2024-06-01
41 results

gitlab-contributors.tester.js

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);
        });
      });
    });