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/dep-names.spec.ts
2024-07-26 08:31:23 +00:00

79 lines
1.8 KiB
TypeScript

import { DepNameMatcher } from './dep-names';
describe('util/package-rules/dep-names', () => {
const depNameMatcher = new DepNameMatcher();
describe('match', () => {
it('should return false if packageFile is not defined', () => {
const result = depNameMatcher.matches(
{
depName: undefined,
},
{
matchDepNames: ['@opentelemetry/http'],
},
);
expect(result).toBeFalse();
});
it('should return false if depName is excluded prefix', () => {
expect(
depNameMatcher.matches(
{
depName: '@opentelemetry/http',
},
{
matchDepNames: ['!/^@opentelemetry/'],
},
),
).toBeFalse();
expect(
depNameMatcher.matches(
{
depName: '@opentelemetry/http',
},
{
matchDepNames: ['!@opentelemetry{/,}**'],
},
),
).toBeFalse();
});
it('should return true if depName is included prefix', () => {
expect(
depNameMatcher.matches(
{
depName: '@opentelemetry/http',
},
{
matchDepNames: ['/^@opentelemetry/'],
},
),
).toBeTrue();
expect(
depNameMatcher.matches(
{
depName: '@opentelemetry/http',
},
{
matchDepNames: ['@opentelemetry{/,}**'],
},
),
).toBeTrue();
});
it('should return false if for wrong prefix', () => {
expect(
depNameMatcher.matches(
{
depName: '@opentelemetry/http',
},
{
matchDepNames: ['@opentelemetry**'],
},
),
).toBeFalse();
});
});
});