forked from renovatebot/renovate
/
default-config.spec.ts
43 lines (40 loc) · 1.55 KB
/
default-config.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { minimatch } from 'minimatch';
import { regexMatches } from '../../../../test/util';
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(target, patt, { dot: true });
});
}
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('fileMatch', () => {
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}
`('regexMatches("$path") === $expected', ({ path, expected }) => {
expect(regexMatches(path, defaultConfig.fileMatch)).toBe(expected);
});
});
});