0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 13:38:32 +00:00
renovatebot_renovate/lib/util/package-rules/package-names.spec.ts
Rhys Arkins 879f7cc212 feat(packageRules): migrate matchers and excludes (#28602)
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-07-25 15:28:16 +02:00

57 lines
1.3 KiB
TypeScript

import { PackageNameMatcher } from './package-names';
describe('util/package-rules/package-names', () => {
const packageNameMatcher = new PackageNameMatcher();
describe('match', () => {
it('should return false if packageName is not defined', () => {
const result = packageNameMatcher.matches(
{
packageName: undefined,
},
{
matchPackageNames: ['@opentelemetry/http'],
},
);
expect(result).toBeFalse();
});
it('should return false if not matching', () => {
const result = packageNameMatcher.matches(
{
depName: 'abc',
packageName: 'def',
},
{
matchPackageNames: ['ghi'],
},
);
expect(result).toBeFalse();
});
it('should matchPackageName', () => {
const result = packageNameMatcher.matches(
{
packageName: 'def',
},
{
matchPackageNames: ['def', 'ghi'],
},
);
expect(result).toBeTrue();
});
it('should match pattern', () => {
const result = packageNameMatcher.matches(
{
packageName: 'b',
},
{
matchPackageNames: ['/b/'],
},
);
expect(result).toBeTrue();
});
});
});