renovate/lib/workers/repository/process/index.spec.ts
2020-09-01 18:33:45 +02:00

34 lines
1.1 KiB
TypeScript

import { RenovateConfig, getConfig, git, mocked } from '../../../../test/util';
import * as _extractUpdate from './extract-update';
import { extractDependencies, updateRepo } from '.';
jest.mock('../../../util/git');
jest.mock('./extract-update');
const extract = mocked(_extractUpdate).extract;
let config: RenovateConfig;
beforeEach(() => {
jest.resetAllMocks();
config = getConfig();
});
describe('workers/repository/process/index', () => {
describe('processRepo()', () => {
it('processes single branches', async () => {
const res = await extractDependencies(config);
expect(res).toMatchSnapshot();
});
it('processes baseBranches', async () => {
extract.mockResolvedValue({} as never);
config.baseBranches = ['branch1', 'branch2'];
git.branchExists.mockReturnValueOnce(false);
git.branchExists.mockReturnValueOnce(true);
git.branchExists.mockReturnValueOnce(false);
git.branchExists.mockReturnValueOnce(true);
const res = await extractDependencies(config);
await updateRepo(config, res.branches);
expect(res).toMatchSnapshot();
});
});
});