0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 13:38:32 +00:00
renovatebot_renovate/lib/config/options/index.spec.ts
2024-11-29 08:49:14 +00:00

51 lines
1.6 KiB
TypeScript

import * as manager from '../../modules/manager';
import * as platform from '../../modules/platform';
import { getOptions } from '.';
jest.unmock('../../modules/platform');
describe('config/options/index', () => {
it('test manager should have no defaultConfig', () => {
jest.doMock('../../modules/manager', () => ({
getManagers: jest.fn(() => new Map().set('testManager', {})),
}));
const opts = getOptions();
expect(opts.filter((o) => o.name === 'testManager')).toEqual([]);
});
it('supportedManagers should have valid names', () => {
const opts = getOptions();
const managerList = Array.from(manager.getManagers().keys());
opts
.filter((option) => option.supportedManagers)
.forEach((option) => {
expect(option.supportedManagers).toBeNonEmptyArray();
for (const item of option.supportedManagers!) {
expect(managerList).toContain(item);
}
});
});
it('supportedPlatforms should have valid names', () => {
const opts = getOptions();
const platformList = Array.from(platform.getPlatforms().keys());
opts
.filter((option) => option.supportedPlatforms)
.forEach((option) => {
expect(option.supportedPlatforms).toBeNonEmptyArray();
for (const item of option.supportedPlatforms!) {
expect(platformList).toContain(item);
}
});
});
it('should not contain duplicate option names', () => {
const optsNames = getOptions().map((option) => option.name);
const optsNameSet = new Set(optsNames);
expect(optsNames).toHaveLength(optsNameSet.size);
});
});