mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-03 02:39:06 +00:00
265e6285c7
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com> Co-authored-by: Rhys Arkins <rhys@arkins.net>
34 lines
885 B
TypeScript
34 lines
885 B
TypeScript
import { check } from './regex-glob-matchers';
|
|
|
|
describe('config/validation-helpers/regex-glob-matchers', () => {
|
|
it('should error for multiple match alls', () => {
|
|
const res = check({
|
|
val: ['*', '**'],
|
|
currentPath: 'hostRules[0].allowedHeaders',
|
|
});
|
|
expect(res).toHaveLength(1);
|
|
});
|
|
|
|
it('should error for invalid regex', () => {
|
|
const res = check({
|
|
val: ['[', '/[/', '/.*[/'],
|
|
currentPath: 'hostRules[0].allowedHeaders',
|
|
});
|
|
expect(res).toHaveLength(2);
|
|
});
|
|
|
|
it('should error for non-strings', () => {
|
|
const res = check({
|
|
val: ['*', 2],
|
|
currentPath: 'hostRules[0].allowedHeaders',
|
|
});
|
|
expect(res).toMatchObject([
|
|
{
|
|
message:
|
|
'hostRules[0].allowedHeaders: should be an array of strings. You have included object.',
|
|
topic: 'Configuration Error',
|
|
},
|
|
]);
|
|
});
|
|
});
|