mirror of
https://github.com/renovatebot/renovate.git
synced 2024-12-22 13:38:32 +00:00
879f7cc212
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com> Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
57 lines
1.3 KiB
TypeScript
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();
|
|
});
|
|
});
|
|
});
|