mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-26 14:36:26 +00:00
test: Use correct fields for PackageRule
type (#33072)
This commit is contained in:
parent
32d72fe5f3
commit
861321fbbe
1 changed files with 21 additions and 6 deletions
|
@ -32,14 +32,23 @@ describe('config/index', () => {
|
||||||
it('merges packageRules', () => {
|
it('merges packageRules', () => {
|
||||||
const parentConfig = { ...defaultConfig };
|
const parentConfig = { ...defaultConfig };
|
||||||
Object.assign(parentConfig, {
|
Object.assign(parentConfig, {
|
||||||
packageRules: [{ a: 1 }, { a: 2 }],
|
packageRules: [
|
||||||
|
{ matchPackageNames: ['pkg1'] },
|
||||||
|
{ matchPackageNames: ['pkg2'] },
|
||||||
|
],
|
||||||
});
|
});
|
||||||
const childConfig = {
|
const childConfig = {
|
||||||
packageRules: [{ a: 3 }, { a: 4 }],
|
packageRules: [
|
||||||
|
{ matchPackageNames: ['pkg3'] },
|
||||||
|
{ matchPackageNames: ['pkg4'] },
|
||||||
|
],
|
||||||
};
|
};
|
||||||
const config = mergeChildConfig(parentConfig, childConfig);
|
const config = mergeChildConfig(parentConfig, childConfig);
|
||||||
expect(config.packageRules.map((rule) => rule.a)).toMatchObject([
|
expect(config.packageRules).toMatchObject([
|
||||||
1, 2, 3, 4,
|
{ matchPackageNames: ['pkg1'] },
|
||||||
|
{ matchPackageNames: ['pkg2'] },
|
||||||
|
{ matchPackageNames: ['pkg3'] },
|
||||||
|
{ matchPackageNames: ['pkg4'] },
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -95,9 +104,15 @@ describe('config/index', () => {
|
||||||
|
|
||||||
it('handles null child packageRules', () => {
|
it('handles null child packageRules', () => {
|
||||||
const parentConfig = { ...defaultConfig };
|
const parentConfig = { ...defaultConfig };
|
||||||
parentConfig.packageRules = [{ a: 3 }, { a: 4 }];
|
parentConfig.packageRules = [
|
||||||
|
{ matchPackageNames: ['pkg1'] },
|
||||||
|
{ matchPackageNames: ['pkg2'] },
|
||||||
|
];
|
||||||
const config = mergeChildConfig(parentConfig, {});
|
const config = mergeChildConfig(parentConfig, {});
|
||||||
expect(config.packageRules).toHaveLength(2);
|
expect(config.packageRules).toMatchObject([
|
||||||
|
{ matchPackageNames: ['pkg1'] },
|
||||||
|
{ matchPackageNames: ['pkg2'] },
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles undefined childConfig', () => {
|
it('handles undefined childConfig', () => {
|
||||||
|
|
Loading…
Reference in a new issue