Skip to content
Snippets Groups Projects
Select Git revision
  • 58df4baee6223ba1cc56dfa70f133aaf189bca22
  • master default protected
  • 7
  • 7.10
  • 7.10.2
  • 7.10.1
  • 7.10.0
  • 7.9
  • 7.9.2
  • 7.9.1
  • 7.9.0
  • 7.8.3
  • 7.8.2
  • 7.8.1
  • 7.8
  • 7.8.0
  • 7.7
  • 7.7.1
  • 7.7.0
  • 7.6
  • 7.6.0
  • 7.5
22 results

gitlab-ci-python.yml

Blame
  • error.spec.js 1.19 KiB
    const { handleError } = require('../../../lib/workers/repository/error');
    
    jest.mock('../../../lib/workers/repository/error-config');
    
    let config;
    beforeEach(() => {
      jest.resetAllMocks();
      config = require('../../_fixtures/config');
    });
    
    describe('workers/repository/error', () => {
      describe('handleError()', () => {
        const errors = [
          'uninitiated',
          'empty',
          'disabled',
          'repository-changed',
          'fork',
          'no-package-files',
          'config-validation',
          'registry-failure',
          'archived',
          'renamed',
          'blocked',
          'not-found',
          'forbidden',
          'bad-credentials',
          'rate-limit-exceeded',
          'lockfile-error',
          'disk-space',
          'platform-failure',
          'no-vulnerability-alerts',
          'cannot-fork',
          'integration-unauthorized',
          'authentication-error',
        ];
        errors.forEach(err => {
          it(`errors ${err}`, async () => {
            const res = await handleError(config, new Error(err));
            expect(res).toEqual(err);
          });
        });
        it('handles unknown error', async () => {
          const res = await handleError(config, new Error('abcdefg'));
          expect(res).toEqual('unknown-error');
        });
      });
    });