forked from renovatebot/renovate
/
migrate-validate.spec.ts
38 lines (35 loc) · 1.17 KB
/
migrate-validate.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { RenovateConfig, getConfig, getName } from '../../test/util';
import { migrateAndValidate } from './migrate-validate';
let config: RenovateConfig;
beforeEach(() => {
jest.resetAllMocks();
config = getConfig();
});
describe(getName(), () => {
describe('migrateAndValidate()', () => {
it('handles empty', async () => {
const res = await migrateAndValidate(config, {});
expect(res).toMatchSnapshot();
});
it('handles migration', async () => {
const input: RenovateConfig = { automerge: 'none' as any };
const res = await migrateAndValidate(config, input);
expect(res).toMatchSnapshot();
});
it('handles invalid', async () => {
const input: RenovateConfig = { foo: 'none' };
const res = await migrateAndValidate(config, input);
expect(res).toMatchSnapshot();
expect(res.errors).toHaveLength(1);
});
it('isOnboarded', async () => {
const input: RenovateConfig = {};
const res = await migrateAndValidate(
{ ...config, repoIsOnboarded: true, warnings: undefined },
input
);
expect(res.warnings).toBeUndefined();
expect(res).toMatchSnapshot();
});
});
});