mirror of
https://github.com/renovatebot/renovate.git
synced 2025-05-12 23:51:55 +00:00
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { GlobalConfig } from '../../../config/global';
|
|
import * as _validate from './validate';
|
|
import { checkReconfigureBranch } from '.';
|
|
import { logger, scm } from '~test/util';
|
|
import type { RenovateConfig } from '~test/util';
|
|
|
|
vi.mock('./validate');
|
|
|
|
const validate = vi.mocked(_validate);
|
|
|
|
describe('workers/repository/reconfigure/index', () => {
|
|
const config: RenovateConfig = {
|
|
branchPrefix: 'prefix/',
|
|
baseBranch: 'base',
|
|
};
|
|
|
|
beforeEach(() => {
|
|
GlobalConfig.reset();
|
|
scm.branchExists.mockResolvedValue(true);
|
|
validate.validateReconfigureBranch.mockResolvedValue(undefined);
|
|
});
|
|
|
|
it('no effect when running with platform=local', async () => {
|
|
GlobalConfig.set({ platform: 'local' });
|
|
await checkReconfigureBranch(config);
|
|
expect(logger.logger.debug).toHaveBeenCalledWith(
|
|
'Not attempting to reconfigure when running with local platform',
|
|
);
|
|
});
|
|
|
|
it('no effect on repo with no reconfigure branch', async () => {
|
|
scm.branchExists.mockResolvedValueOnce(false);
|
|
await checkReconfigureBranch(config);
|
|
expect(logger.logger.debug).toHaveBeenCalledWith(
|
|
'No reconfigure branch found',
|
|
);
|
|
});
|
|
|
|
it('validates reconfigure branch', async () => {
|
|
await expect(checkReconfigureBranch(config)).toResolve();
|
|
});
|
|
});
|