mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-14 08:36:26 +00:00
e4dead2e35
Closes #20926 BREAKING CHANGE: matchPackageNames now matches both depName (existing) and packageName (new)
45 lines
1.1 KiB
TypeScript
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();
|
|
});
|
|
});
|
|
});
|