renovate/lib/util/package-rules/package-patterns.spec.ts
Rhys Arkins e4dead2e35 feat(package-rules)!: match packageName for matchPackageNames (#22703)
Closes #20926

BREAKING CHANGE: matchPackageNames now matches both depName (existing) and packageName (new)
2023-07-04 19:21:52 +02:00

45 lines
1.1 KiB
TypeScript

import { PackagePatternsMatcher } from './package-patterns';
describe('util/package-rules/package-patterns', () => {
const packageNameMatcher = new PackagePatternsMatcher();
describe('match', () => {
it('should return false if depName is not defined', () => {
const result = packageNameMatcher.matches(
{
depName: undefined,
},
{
matchPackagePatterns: ['@opentelemetry/http'],
}
);
expect(result).toBeFalse();
});
it('should match packageName', () => {
const result = packageNameMatcher.matches(
{
depName: 'abc',
packageName: 'def',
},
{
matchPackagePatterns: ['def'],
}
);
expect(result).toBeTrue();
});
it('should fall back to matching depName', () => {
const result = packageNameMatcher.matches(
{
depName: 'abc',
packageName: 'def',
},
{
matchPackagePatterns: ['abc'],
}
);
expect(result).toBeTrue();
});
});
});