renovate/lib/workers/repository/index.spec.ts

41 lines
1.1 KiB
TypeScript
Raw Normal View History

2020-03-05 20:57:24 +00:00
import { mock } from 'jest-mock-extended';
import { RenovateConfig, getConfig, mocked } from '../../../test/util';
import { GlobalConfig } from '../../config/global';
2020-03-05 20:57:24 +00:00
import * as _process from './process';
import type { ExtractResult } from './process/extract-update';
2020-05-01 16:03:48 +00:00
import { renovateRepository } from '.';
2020-03-05 20:57:24 +00:00
const process = mocked(_process);
jest.mock('./init');
jest.mock('./process');
jest.mock('./result');
jest.mock('./error');
describe('workers/repository/index', () => {
2020-03-05 20:57:24 +00:00
describe('renovateRepository()', () => {
let config: RenovateConfig;
2020-03-05 20:57:24 +00:00
beforeEach(() => {
config = getConfig();
});
2020-03-05 20:57:24 +00:00
it('runs', async () => {
process.extractDependencies.mockResolvedValue(mock<ExtractResult>());
2020-03-05 20:57:24 +00:00
const res = await renovateRepository(config);
expect(res).toBeUndefined();
2020-03-05 20:57:24 +00:00
});
it('shows endpoint', async () => {
process.extractDependencies.mockResolvedValue(mock<ExtractResult>());
const res = await renovateRepository({
...config,
endpoint: 'https://github.com',
});
expect(GlobalConfig.get().endpoint).toBe('https://github.com');
expect(res).toBeUndefined();
});
2020-03-05 20:57:24 +00:00
});
});