0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-05-12 23:51:55 +00:00
renovatebot_renovate/lib/modules/manager/hermit/default-config.spec.ts
RahulGautamSingh bc7d0595d0
feat(config): managerFilePatterns (#34615)
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2025-05-04 08:30:24 +00:00

45 lines
1.6 KiB
TypeScript

import { minimatch } from '../../../util/minimatch';
import { matchRegexOrGlobList } from '../../../util/string-match';
import { defaultConfig } from './default-config';
describe('modules/manager/hermit/default-config', () => {
describe('excludeCommitPaths', () => {
function miniMatches(target: string, patterns: string[]): boolean {
return patterns.some((patt: string) => {
return minimatch(patt, { dot: true }).match(target);
});
}
it.each`
path | expected
${'bin/hermit'} | ${true}
${'gradle/bin/hermit'} | ${true}
${'nested/module/bin/hermit'} | ${true}
${'nested/testbin/hermit'} | ${false}
${'other'} | ${false}
${'nested/other'} | ${false}
${'nested/module/other'} | ${false}
`('minimatches("$path") === $expected', ({ path, expected }) => {
expect(miniMatches(path, defaultConfig.excludeCommitPaths)).toBe(
expected,
);
});
});
describe('managerFilePatterns', () => {
it.each`
path | expected
${'bin/hermit'} | ${true}
${'gradle/bin/hermit'} | ${true}
${'nested/module/bin/hermit'} | ${true}
${'nested/testbin/hermit'} | ${false}
${'other'} | ${false}
${'nested/other'} | ${false}
${'nested/module/other'} | ${false}
`('matchRegexOrGlobList("$path") === $expected', ({ path, expected }) => {
expect(
matchRegexOrGlobList(path, defaultConfig.managerFilePatterns),
).toBe(expected);
});
});
});