renovate/test/config/migrate-validate.spec.js
Rhys Arkins b89f448946
feat: validate packageRule selectors (#1728)
Validates that each packageRule must contain at least one selector. Resolves the rule first to allow for presets.

Closes #1345, Closes #1693
2018-03-28 10:04:07 +02:00

27 lines
836 B
JavaScript

const { migrateAndValidate } = require('../../lib/config/migrate-validate');
let config;
beforeEach(() => {
jest.resetAllMocks();
config = { ...require('../_fixtures/config') };
});
describe('config/migrate-validate', () => {
describe('migrateAndValidate()', () => {
it('handles empty', async () => {
const res = await migrateAndValidate(config, {});
expect(res).toMatchSnapshot();
});
it('handles migration', async () => {
const input = { automerge: 'none' };
const res = await migrateAndValidate(config, input);
expect(res).toMatchSnapshot();
});
it('handles invalid', async () => {
const input = { foo: 'none' };
const res = await migrateAndValidate(config, input);
expect(res).toMatchSnapshot();
expect(res.errors).toHaveLength(1);
});
});
});