Skip to content
Snippets Groups Projects
Select Git revision
  • 96a7f36e08db8317d04801498035a58e9cb86d09
  • master default protected
  • dependabot/npm_and_yarn/nock-14.0.10
  • gh-pages
  • dependabot/npm_and_yarn/react-19.1.1
  • dependabot/npm_and_yarn/react-dom-19.1.1
  • dependabot/github_actions/actions/checkout-5
  • server-2025-08-01-57ada99c
  • 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-2025-08-03
  • 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
41 results

capture-timings.js

Blame
  • master-issue.spec.ts 15.10 KiB
    import fs from 'fs';
    import { mock } from 'jest-mock-extended';
    import { RenovateConfig, getConfig, platform } from '../../../test/util';
    import { PLATFORM_TYPE_GITHUB } from '../../constants/platforms';
    import { PR_STATE_NOT_OPEN } from '../../constants/pull-requests';
    import { Platform, Pr } from '../../platform';
    import { BranchConfig, BranchUpgradeConfig } from '../common';
    import * as dependencyDashboard from './master-issue';
    
    type PrUpgrade = BranchUpgradeConfig;
    
    let config: RenovateConfig;
    beforeEach(() => {
      jest.resetAllMocks();
      config = getConfig();
      config.platform = PLATFORM_TYPE_GITHUB;
      config.errors = [];
      config.warnings = [];
    });
    
    async function dryRun(
      branches: BranchConfig[],
      // eslint-disable-next-line no-shadow
      platform: jest.Mocked<Platform>,
      ensureIssueClosingCalls = 0,
      ensureIssueCalls = 0,
      getBranchPrCalls = 0,
      findPrCalls = 0
    ) {
      jest.resetAllMocks();
      config.dryRun = true;
      await dependencyDashboard.ensureMasterIssue(config, branches);
      expect(platform.ensureIssueClosing).toHaveBeenCalledTimes(
        ensureIssueClosingCalls
      );
      expect(platform.ensureIssue).toHaveBeenCalledTimes(ensureIssueCalls);
      expect(platform.getBranchPr).toHaveBeenCalledTimes(getBranchPrCalls);
      expect(platform.findPr).toHaveBeenCalledTimes(findPrCalls);
    }
    
    describe('workers/repository/master-issue', () => {
      describe('ensureMasterIssue()', () => {
        it('do nothing if masterissue is disable', async () => {
          const branches: BranchConfig[] = [];
          await dependencyDashboard.ensureMasterIssue(config, branches);
          expect(platform.ensureIssueClosing).toHaveBeenCalledTimes(0);
          expect(platform.ensureIssue).toHaveBeenCalledTimes(0);
          expect(platform.getBranchPr).toHaveBeenCalledTimes(0);
          expect(platform.findPr).toHaveBeenCalledTimes(0);
    
          // same with dry run
          await dryRun(branches, platform);
        });
    
        it('do nothing if it has no masterissueapproval branches', async () => {
          const branches = [
            {
              ...mock<BranchConfig>(),
              prTitle: 'pr1',
            },
            {
              ...mock<BranchConfig>(),
              prTitle: 'pr2',
              dependencyDashboardApproval: false,
            },
          ];
          await dependencyDashboard.ensureMasterIssue(config, branches);
          expect(platform.ensureIssueClosing).toHaveBeenCalledTimes(0);
          expect(platform.ensureIssue).toHaveBeenCalledTimes(0);
          expect(platform.getBranchPr).toHaveBeenCalledTimes(0);