mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16:26 +00:00
42 lines
1 KiB
JavaScript
42 lines
1 KiB
JavaScript
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',
|
|
'disabled',
|
|
'repository-changed',
|
|
'fork',
|
|
'no-package-files',
|
|
'config-validation',
|
|
'registry-failure',
|
|
'archived',
|
|
'renamed',
|
|
'blocked',
|
|
'not-found',
|
|
'forbidden',
|
|
'rate-limit-exceeded',
|
|
'lockfile-error',
|
|
'platform-failure',
|
|
'no-vulnerability-alerts',
|
|
];
|
|
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');
|
|
});
|
|
});
|
|
});
|