mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16:26 +00:00
6f60289782
* install npm from npm * use embedded npm and remove versions checking
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
const globalWorker = require('../../../lib/workers/global');
|
|
const repositoryWorker = require('../../../lib/workers/repository');
|
|
const configParser = require('../../../lib/config');
|
|
|
|
describe('lib/workers/global', () => {
|
|
beforeEach(() => {
|
|
jest.resetAllMocks();
|
|
configParser.parseConfigs = jest.fn();
|
|
configParser.getRepositoryConfig = jest.fn();
|
|
repositoryWorker.renovateRepository = jest.fn();
|
|
});
|
|
it('handles config warnings and errors', async () => {
|
|
configParser.parseConfigs.mockReturnValueOnce({
|
|
repositories: [],
|
|
maintainYarnLock: true,
|
|
foo: 1,
|
|
});
|
|
await globalWorker.start();
|
|
});
|
|
it('handles zero repos', async () => {
|
|
configParser.parseConfigs.mockReturnValueOnce({
|
|
repositories: [],
|
|
});
|
|
await globalWorker.start();
|
|
});
|
|
it('processes repositories', async () => {
|
|
configParser.parseConfigs.mockReturnValueOnce({
|
|
enabled: true,
|
|
repositories: ['a', 'b'],
|
|
});
|
|
await globalWorker.start();
|
|
expect(configParser.parseConfigs.mock.calls.length).toBe(1);
|
|
expect(repositoryWorker.renovateRepository.mock.calls.length).toBe(2);
|
|
});
|
|
it('catches errors', async () => {
|
|
configParser.parseConfigs.mockImplementationOnce(() => {
|
|
throw new Error('a');
|
|
});
|
|
await globalWorker.start();
|
|
});
|
|
});
|