Skip to content
Snippets Groups Projects
Select Git revision
  • 070df56d007cd6c27c1b45d9f26e897397fc40d9
  • main default protected
  • renovate/main-renovatebot-osv-offline-1.x
  • fix/36927-maven-tags
  • renovate/main-redis-5.x
  • next
  • revert-31645-feat/rename-gradle-wrapper-validation-action
  • fix/36615b-branch-reuse-no-cache
  • chore/punycode
  • refactor/pin-new-value
  • feat/36219--git-x509-signing
  • feat/structured-logger
  • hotfix/39.264.1
  • feat/skip-dangling
  • gh-readonly-queue/next/pr-36034-7a061c4ca1024a19e2c295d773d9642625d1c2be
  • hotfix/39.238.3
  • refactor/gitlab-auto-approve
  • feat/template-strings
  • gh-readonly-queue/next/pr-35654-137d934242c784e0c45d4b957362214f0eade1d7
  • fix/32307-global-extends-merging
  • fix/32307-global-extends-repositories
  • 41.37.7
  • 41.37.6
  • 41.37.5
  • 41.37.4
  • 41.37.3
  • 41.37.2
  • 41.37.1
  • 41.37.0
  • 41.36.2
  • 41.36.1
  • 41.36.0
  • 41.35.2
  • 41.35.1
  • 41.35.0
  • 41.34.1
  • 41.34.0
  • 41.33.0
  • 41.32.3
  • 41.32.2
  • 41.32.1
41 results

jest.config.ts

Blame
  • deprecated.spec.ts 2.10 KiB
    import { RenovateConfig, platform } from '../../../../test/util';
    import { raiseDeprecationWarnings } from './deprecated';
    
    describe('workers/repository/process/deprecated', () => {
      describe('raiseDeprecationWarnings()', () => {
        it('returns if onboarding', async () => {
          const config = {};
          await expect(raiseDeprecationWarnings(config, {})).resolves.not.toThrow();
        });
    
        it('returns if disabled', async () => {
          const config: RenovateConfig = {
            repoIsOnboarded: true,
            suppressNotifications: ['deprecationWarningIssues'],
          };
          await expect(raiseDeprecationWarnings(config, {})).resolves.not.toThrow();
        });
    
        it('raises deprecation warnings', async () => {
          const config: RenovateConfig = {
            repoIsOnboarded: true,
            suppressNotifications: [],
          };
          const packageFiles = {
            npm: [
              {
                packageFile: 'package.json',
                deps: [
                  {
                    depName: 'foo',
                    deprecationMessage: 'foo is deprecated',
                  },
                  {
                    depName: 'bar',
                  },
                ],
              },
              {
                packageFile: 'backend/package.json',
                deps: [],
              },
              {
                packageFile: 'frontend/package.json',
                deps: [
                  {
                    depName: 'abc',
                  },
                  {
                    depName: 'foo',
                    deprecationMessage: 'foo is deprecated',
                  },
                ],
              },
            ],
          };
          const mockIssue = [
            {
              title: 'Dependency deprecation warning: mockDependency (mockManager)',
              state: 'open',
            },
          ];
          platform.getIssueList.mockResolvedValue(mockIssue);
          await raiseDeprecationWarnings(config, packageFiles);
          expect(platform.ensureIssue.mock.calls).toMatchObject([
            [{ once: true, title: 'Dependency deprecation warning: foo (npm)' }],
          ]);
          expect(platform.getIssueList).toHaveBeenCalledTimes(1);
          expect(platform.ensureIssue).toHaveBeenCalledTimes(1);
        });
      });
    });